Version 1
[yaffs-website] / vendor / drupal / console / src / Command / Cron / DebugCommand.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\Console\Command\Cron\DebugCommand.
6  */
7
8 namespace Drupal\Console\Command\Cron;
9
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Symfony\Component\Console\Command\Command;
13 use Drupal\Core\Extension\ModuleHandlerInterface;
14 use Drupal\Console\Core\Command\Shared\CommandTrait;
15 use Drupal\Console\Core\Style\DrupalStyle;
16
17 class DebugCommand extends Command
18 {
19     use CommandTrait;
20
21     /**
22      * @var ModuleHandlerInterface
23      */
24     protected $moduleHandler;
25
26     /**
27      * DebugCommand constructor.
28      *
29      * @param ModuleHandlerInterface $moduleHandler
30      */
31     public function __construct(ModuleHandlerInterface $moduleHandler)
32     {
33         $this->moduleHandler = $moduleHandler;
34         parent::__construct();
35     }
36
37     /**
38      * {@inheritdoc}
39      */
40     protected function configure()
41     {
42         $this
43             ->setName('cron:debug')
44             ->setDescription($this->trans('commands.cron.debug.description'));
45     }
46
47     /**
48      * {@inheritdoc}
49      */
50     protected function execute(InputInterface $input, OutputInterface $output)
51     {
52         $io = new DrupalStyle($input, $output);
53
54         $io->section(
55             $this->trans('commands.cron.debug.messages.module-list')
56         );
57
58         $io->table(
59             [
60                 $this->trans('commands.cron.debug.messages.module')
61             ],
62             $this->moduleHandler->getImplementations('cron'),
63             'compact'
64         );
65     }
66 }