Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Cli / DebugCommand.php
1 <?php
2
3 /*
4  * This file is part of the Behat Testwork.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Testwork\Cli;
12
13 use Behat\Testwork\ServiceContainer\Configuration\ConfigurationLoader;
14 use Behat\Testwork\ServiceContainer\ExtensionManager;
15 use Symfony\Component\Console\Command\Command as BaseCommand;
16 use Symfony\Component\Console\Input\InputInterface;
17 use Symfony\Component\Console\Output\OutputInterface;
18
19 /**
20  * Provides debug information about the current environment.
21  *
22  * @author Konstantin Kudryashov <ever.zet@gmail.com>
23  */
24 final class DebugCommand extends BaseCommand
25 {
26     /**
27      * @var Application
28      */
29     private $application;
30     /**
31      * @var ConfigurationLoader
32      */
33     private $configurationLoader;
34     /**
35      * @var ExtensionManager
36      */
37     private $extensionManager;
38
39     /**
40      * Initialises command.
41      *
42      * @param Application         $application
43      * @param ConfigurationLoader $configurationLoader
44      * @param ExtensionManager    $extensionManager
45      */
46     public function __construct(
47         Application $application,
48         ConfigurationLoader $configurationLoader,
49         ExtensionManager $extensionManager
50     ) {
51         $this->application = $application;
52         $this->configurationLoader = $configurationLoader;
53         $this->extensionManager = $extensionManager;
54
55         parent::__construct('debug');
56     }
57
58     /**
59      * {@inheritdoc}
60      */
61     protected function execute(InputInterface $input, OutputInterface $output)
62     {
63         $output->writeln(sprintf('%s version %s', $this->application->getName(), $this->application->getVersion()));
64
65         $output->writeln('');
66
67         $debug = $this->configurationLoader->debugInformation();
68         $output->writeln('--- configuration');
69         $output->writeln(sprintf('    environment variable (%s): %s', $debug['environment_variable_name'], $debug['environment_variable_content']));
70         $output->writeln(sprintf('    configuration file: %s', $debug['configuration_file_path']));
71
72         $output->writeln('');
73
74         $debug = $this->extensionManager->debugInformation();
75         $output->writeln('--- extensions');
76         $output->writeln(sprintf('    extensions loaded: %s', count($debug['extensions_list']) ? implode(', ', $debug['extensions_list']) : 'none'));
77
78         $output->writeln('');
79     }
80 }