X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FDebug%2FChainCommand.php;fp=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FDebug%2FChainCommand.php;h=d0f0e23cfae1b105fad785504ce4f1e9b27d575c;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console-core/src/Command/Debug/ChainCommand.php b/vendor/drupal/console-core/src/Command/Debug/ChainCommand.php new file mode 100644 index 000000000..d0f0e23cf --- /dev/null +++ b/vendor/drupal/console-core/src/Command/Debug/ChainCommand.php @@ -0,0 +1,91 @@ +chainDiscovery = $chainDiscovery; + + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('debug:chain') + ->setDescription($this->trans('commands.debug.chain.description')) + ->setAliases(['dch']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $files = $this->chainDiscovery->getFiles(); + $filesPerDirectory = $this->chainDiscovery->getFilesPerDirectory(); + + if (!$files || !$filesPerDirectory) { + $this->getIo()->warning($this->trans('commands.debug.chain.messages.no-files')); + + return 0; + } + + foreach ($filesPerDirectory as $directory => $fileNames) { + $this->getIo()->info(' ' . $this->trans('commands.debug.chain.messages.directory'), false); + $this->getIo()->comment($directory); + + $tableHeader = [ + $this->trans('commands.debug.chain.messages.file'), + $this->trans('commands.debug.chain.messages.command') + ]; + + $tableRows = []; + foreach ($fileNames as $file) { + $commandName = ''; + if (array_key_exists('command', $files[$directory.$file])) { + $commandName = $files[$directory.$file]['command']; + } + $tableRows[] = [ + 'file' => $file, + 'command' => $commandName + ]; + } + + $this->getIo()->table($tableHeader, $tableRows); + } + + return 0; + } +}