diff --git a/services.yml b/services.yml index 2d0f3c5..3a3918f 100644 --- a/services.yml +++ b/services.yml @@ -60,7 +60,7 @@ services: - { name: drupal.command } console.settings_debug: class: Drupal\Console\Core\Command\Debug\SettingsCommand - arguments: ['@console.configuration_manager', '@console.nested_array'] + arguments: ['@console.configuration_manager'] tags: - { name: drupal.command } console.settings_set: diff --git a/src/Command/Debug/SettingsCommand.php b/src/Command/Debug/SettingsCommand.php index 9e6dfeb..4bd0702 100644 --- a/src/Command/Debug/SettingsCommand.php +++ b/src/Command/Debug/SettingsCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Utils\ConfigurationManager; -use Drupal\Console\Core\Utils\NestedArray; use Drupal\Console\Core\Style\DrupalStyle; +use Symfony\Component\Yaml\Yaml; /** * Class SettingsCommand @@ -26,23 +26,15 @@ class SettingsCommand extends Command */ protected $configurationManager; - /** - * @var NestedArray - */ - protected $nestedArray; - /** * CheckCommand constructor. * * @param ConfigurationManager $configurationManager - * @param NestedArray $nestedArray */ public function __construct( - ConfigurationManager $configurationManager, - NestedArray $nestedArray + ConfigurationManager $configurationManager ) { $this->configurationManager = $configurationManager; - $this->nestedArray = $nestedArray; parent::__construct(); } @@ -66,56 +58,21 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); $configuration = $this->configurationManager->getConfiguration(); - $configApplication = $configuration->get('application'); - - unset($configApplication['autowire']); - unset($configApplication['languages']); - unset($configApplication['aliases']); - unset($configApplication['composer']); - unset($configApplication['default']['commands']); + $configApplication['application'] = $configuration->getRaw('application'); - $configApplicationFlatten = []; - $keyFlatten = ''; - - $this->nestedArray->yamlFlattenArray( - $configApplication, - $configApplicationFlatten, - $keyFlatten - ); - - $tableHeader = [ - $this->trans('commands.debug.settings.messages.config-key'), - $this->trans('commands.debug.settings.messages.config-value'), - ]; - - $tableRows = []; - foreach ($configApplicationFlatten as $ymlKey => $ymlValue) { - $tableRows[] = [ - $ymlKey, - $ymlValue - ]; - } - - $io->newLine(); - $io->info( - sprintf( - '%s :', - $this->trans('commands.debug.settings.messages.config-file') - ), - false - ); - - $io->comment( - sprintf( - '%s/.console/config.yml', - $this->configurationManager->getHomeDirectory() - ), - true - ); + $io->write(Yaml::dump($configApplication, 6, 2)); $io->newLine(); - - $io->table($tableHeader, $tableRows, 'compact'); + $io->info($this->trans('commands.debug.settings.messages.config-file')); + + $configurationFiles = []; + foreach ($this->configurationManager->getConfigurationFiles() as $key => $configurationFile) { + $configurationFiles = array_merge( + $configurationFiles, + $configurationFile + ); + } + $io->listing($configurationFiles); return 0; } diff --git a/src/Utils/ConfigurationManager.php b/src/Utils/ConfigurationManager.php index aa66854..b2e43cd 100644 --- a/src/Utils/ConfigurationManager.php +++ b/src/Utils/ConfigurationManager.php @@ -380,6 +380,14 @@ public function getSites() return $this->sites; } + /** + * @return array + */ + public function getConfigurationFiles() { + return $this->configurationFiles; + } + + public function getHomeDirectory() { return Path::getHomeDirectory();