You are here

class SanityCheckCommand in MongoDB 8.2

Class SanityCheckCommand provides the mongodb:watchdog:sanitycheck command.

@DrupalCommand ( extension="mongodb_watchdog", extensionType="module" )

Hierarchy

  • class \Drupal\mongodb_watchdog\Command\SanityCheckCommand extends \Drupal\Console\Core\Command\ContainerAwareCommand

Expanded class hierarchy of SanityCheckCommand

1 string reference to 'SanityCheckCommand'
console.services.yml in modules/mongodb_watchdog/console.services.yml
modules/mongodb_watchdog/console.services.yml
1 service uses SanityCheckCommand
mongodb_watchdog.command.sanitycheck in modules/mongodb_watchdog/console.services.yml
Drupal\mongodb_watchdog\Command\SanityCheckCommand

File

modules/mongodb_watchdog/src/Command/SanityCheckCommand.php, line 23

Namespace

Drupal\mongodb_watchdog\Command
View source
class SanityCheckCommand extends ContainerAwareCommand {

  /**
   * The mongodb.watchdog.sanity_check service.
   *
   * @var \Drupal\mongodb_watchdog\Install\SanityCheck
   */
  protected $sanityCheck;

  /**
   * The serialisation.yaml service.
   *
   * @var \Drupal\Component\Serialization\Yaml
   */
  protected $yaml;

  /**
   * SanityCheckCommand constructor.
   *
   * @param \Drupal\mongodb_watchdog\Install\Sanitycheck $sanityCheck
   *   The mongodb.watchdog.sanity_check service.
   * @param \Drupal\Component\Serialization\Yaml $yaml
   *   The serialization.yaml service.
   */
  public function __construct(Sanitycheck $sanityCheck, Yaml $yaml) {
    parent::__construct();
    $this->sanityCheck = $sanityCheck;
    $this->yaml = $yaml;
  }

  /**
   * {@inheritdoc}
   */
  protected function configure() : void {
    $this
      ->setName('mongodb:watchdog:sanitycheck')
      ->setDescription($this
      ->trans('commands.mongodb.watchdog.sanitycheck.description'))
      ->setHelp($this
      ->trans('commands.mongodb.watchdog.sanitycheck.help'))
      ->setAliases([
      'mdbwsc',
      'mowd-sc',
    ]);
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) : void {
    $buckets = $this->sanityCheck
      ->buildCollectionstats();
    $this
      ->getIo()
      ->writeln($this->yaml
      ->encode($buckets));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SanityCheckCommand::$sanityCheck protected property The mongodb.watchdog.sanity_check service.
SanityCheckCommand::$yaml protected property The serialisation.yaml service.
SanityCheckCommand::configure protected function
SanityCheckCommand::execute protected function
SanityCheckCommand::__construct public function SanityCheckCommand constructor.