5 * Contains \Drupal\Console\Core\Command\Debug\ChainCommand.
8 namespace Drupal\Console\Core\Command\Debug;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Drupal\Console\Core\Command\Command;
13 use Drupal\Console\Core\Utils\ChainDiscovery;
18 * @package Drupal\Console\Core\Command\Debug
20 class ChainCommand extends Command
25 protected $chainDiscovery;
28 * ChainCommand constructor.
30 * @param ChainDiscovery $chainDiscovery
32 public function __construct(
33 ChainDiscovery $chainDiscovery
35 $this->chainDiscovery = $chainDiscovery;
37 parent::__construct();
43 protected function configure()
46 ->setName('debug:chain')
47 ->setDescription($this->trans('commands.debug.chain.description'))
48 ->setAliases(['dch']);
54 protected function execute(InputInterface $input, OutputInterface $output)
56 $files = $this->chainDiscovery->getFiles();
57 $filesPerDirectory = $this->chainDiscovery->getFilesPerDirectory();
59 if (!$files || !$filesPerDirectory) {
60 $this->getIo()->warning($this->trans('commands.debug.chain.messages.no-files'));
65 foreach ($filesPerDirectory as $directory => $fileNames) {
66 $this->getIo()->info(' ' . $this->trans('commands.debug.chain.messages.directory'), false);
67 $this->getIo()->comment($directory);
70 $this->trans('commands.debug.chain.messages.file'),
71 $this->trans('commands.debug.chain.messages.command')
75 foreach ($fileNames as $file) {
77 if (array_key_exists('command', $files[$directory.$file])) {
78 $commandName = $files[$directory.$file]['command'];
82 'command' => $commandName
86 $this->getIo()->table($tableHeader, $tableRows);