X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FDebug%2FSiteCommand.php;fp=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FSite%2FDebugCommand.php;h=b496b2aa3af127d473989c18b34c6b22a5a08e2b;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=74ecad33b0824368de21eda7a866a845c2438a14;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/drupal/console-core/src/Command/Site/DebugCommand.php b/vendor/drupal/console-core/src/Command/Debug/SiteCommand.php similarity index 55% rename from vendor/drupal/console-core/src/Command/Site/DebugCommand.php rename to vendor/drupal/console-core/src/Command/Debug/SiteCommand.php index 74ecad33b..b496b2aa3 100644 --- a/vendor/drupal/console-core/src/Command/Site/DebugCommand.php +++ b/vendor/drupal/console-core/src/Command/Debug/SiteCommand.php @@ -2,36 +2,32 @@ /** * @file - * Contains \Drupal\Console\Core\Command\Site\DebugCommand. + * Contains \Drupal\Console\Core\Command\Debug\SiteCommand. */ -namespace Drupal\Console\Core\Command\Site; +namespace Drupal\Console\Core\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Dumper; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Utils\ConfigurationManager; -use Drupal\Console\Core\Style\DrupalStyle; /** - * Class SiteDebugCommand + * Class SiteCommand * - * @package Drupal\Console\Core\Command\Site + * @package Drupal\Console\Core\Command\Debug */ -class DebugCommand extends Command +class SiteCommand extends Command { - use CommandTrait; - /** * @var ConfigurationManager */ protected $configurationManager; /** - * DebugCommand constructor. + * SiteCommand constructor. * * @param ConfigurationManager $configurationManager */ @@ -48,21 +44,22 @@ class DebugCommand extends Command public function configure() { $this - ->setName('site:debug') - ->setDescription($this->trans('commands.site.debug.description')) + ->setName('debug:site') + ->setDescription($this->trans('commands.debug.site.description')) ->addArgument( 'target', InputArgument::OPTIONAL, - $this->trans('commands.site.debug.options.target'), + $this->trans('commands.debug.site.options.target'), null ) ->addArgument( 'property', InputArgument::OPTIONAL, - $this->trans('commands.site.debug.options.property'), + $this->trans('commands.debug.site.options.property'), null ) - ->setHelp($this->trans('commands.site.debug.help')); + ->setHelp($this->trans('commands.debug.site.help')) + ->setAliases(['dsi']); } /** @@ -70,32 +67,37 @@ class DebugCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - - $sites = array_keys($this->configurationManager->getSites()); + $sites = $this->configurationManager->getSites(); if (!$sites) { - $io->error($this->trans('commands.site.debug.messages.invalid-sites')); + $this->getIo()->warning($this->trans('commands.debug.site.messages.invalid-sites')); - return 1; + return 0; } - - // --target argument $target = $input->getArgument('target'); if (!$target) { - $tableHeader =[ - $this->trans('commands.site.debug.messages.site'), - ]; - - $io->table($tableHeader, $sites); + foreach ($sites as $key => $site) { + $environments = array_keys($site); + unset($environments[0]); + + $environments = array_map( + function ($element) use ($key) { + return $key . '.' . $element; + }, + $environments + ); + + $this->getIo()->info($key); + $this->getIo()->listing($environments); + } return 0; } $targetConfig = $this->configurationManager->readTarget($target); if (!$targetConfig) { - $io->error($this->trans('commands.site.debug.messages.invalid-site')); + $this->getIo()->error($this->trans('commands.debug.site.messages.invalid-site')); return 1; } @@ -110,13 +112,13 @@ class DebugCommand extends Command $val = &$val[$property_key]; } - $io->writeln($val); + $this->getIo()->writeln($val); return 0; } - $io->info($target); + $this->getIo()->info($target); $dumper = new Dumper(); - $io->writeln($dumper->dump($targetConfig, 2)); + $this->getIo()->writeln($dumper->dump($targetConfig, 4, 2)); return 0; }