Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / src / Command / Config / SettingsDebugCommand.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\Console\Command\Config\SettingsDebugCommand.
6  */
7
8 namespace Drupal\Console\Command\Config;
9
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Drupal\Component\Serialization\Yaml;
13 use Drupal\Console\Core\Style\DrupalStyle;
14 use Symfony\Component\Console\Command\Command;
15 use Drupal\Console\Core\Command\Shared\CommandTrait;
16 use Drupal\Core\Site\Settings;
17
18 /**
19  * Class DebugCommand
20  *
21  * @package Drupal\Console\Command\Config
22  */
23 class SettingsDebugCommand extends Command
24 {
25     use CommandTrait;
26
27     /**
28      * @var Settings
29      */
30     protected $settings;
31
32     /**
33      * SettingsDebugCommand constructor.
34      *
35      * @param Settings $settings
36      */
37     public function __construct(Settings $settings)
38     {
39         $this->settings = $settings;
40         ;
41         parent::__construct();
42     }
43     /**
44      * {@inheritdoc}
45      */
46     protected function configure()
47     {
48         $this
49             ->setName('config:settings:debug')
50             ->setDescription($this->trans('commands.config.settings.debug.description'))
51             ->setHelp($this->trans('commands.config.settings.debug.help'));
52     }
53
54     /**
55      * {@inheritdoc}
56      */
57     protected function execute(InputInterface $input, OutputInterface $output)
58     {
59         $io = new DrupalStyle($input, $output);
60
61         $settingKeys = array_keys($this->settings->getAll());
62
63         $io->newLine();
64         $io->info($this->trans('commands.config.settings.debug.messages.current'));
65         $io->newLine();
66
67         foreach ($settingKeys as $settingKey) {
68             $settingValue = $this->settings->get($settingKey);
69             $io->comment($settingKey . ': ', is_array($settingValue));
70             $io->write(Yaml::encode($settingValue));
71         }
72         $io->newLine();
73     }
74 }