5c7b5f1c38375421e6c896e95c14bc7d88108a8b
[yaffs-website] / vendor / drupal / console / src / Command / Features / DebugCommand.php
1 <?php
2
3 /**
4 * @file
5 * Contains \Drupal\Console\Command\Features\DebugCommand.
6 */
7
8 namespace Drupal\Console\Command\Features;
9
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Drupal\Console\Command\Shared\FeatureTrait;
14 use Drupal\Console\Core\Command\Shared\CommandTrait;
15 use Drupal\Console\Core\Style\DrupalStyle;
16 use Drupal\Console\Annotations\DrupalCommand;
17 use Symfony\Component\Console\Command\Command;
18
19 /**
20  * @DrupalCommand(
21  *     extension = "features",
22  *     extensionType = "module"
23  * )
24  */
25
26 class DebugCommand extends Command
27 {
28     use CommandTrait;
29     use FeatureTrait;
30
31     protected function configure()
32     {
33         $this
34             ->setName('features:debug')
35             ->setDescription($this->trans('commands.features.debug.description'))
36             ->addArgument(
37                 'bundle',
38                 InputArgument::OPTIONAL,
39                 $this->trans('commands.features.debug.arguments.bundle')
40             );
41     }
42
43     protected function execute(InputInterface $input, OutputInterface $output)
44     {
45         $io = new DrupalStyle($input, $output);
46         $bundle= $input->getArgument('bundle');
47
48         $tableHeader = [
49             $this->trans('commands.features.debug.messages.bundle'),
50             $this->trans('commands.features.debug.messages.name'),
51             $this->trans('commands.features.debug.messages.machine_name'),
52             $this->trans('commands.features.debug.messages.status'),
53             $this->trans('commands.features.debug.messages.state'),
54         ];
55
56         $tableRows = [];
57        
58         $features = $this->getFeatureList($io, $bundle);
59    
60         foreach ($features as $feature) {
61             $tableRows[] = [$feature['bundle_name'],$feature['name'], $feature['machine_name'], $feature['status'],$feature['state']];
62         }
63
64         $io->table($tableHeader, $tableRows, 'compact');
65     }
66 }