Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Cli / DumpReferenceCommand.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\ConfigurationTree;
14 use Behat\Testwork\ServiceContainer\ExtensionManager;
15 use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper;
16 use Symfony\Component\Config\Definition\ReferenceDumper;
17 use Symfony\Component\Console\Command\Command as BaseCommand;
18 use Symfony\Component\Console\Input\InputInterface;
19 use Symfony\Component\Console\Output\OutputInterface;
20
21 /**
22  * Extends Symfony console application with testwork functionality.
23  *
24  * @author Christophe Coevoet <stof>
25  */
26 final class DumpReferenceCommand extends BaseCommand
27 {
28     /**
29      * @var ExtensionManager
30      */
31     private $extensionManager;
32
33     /**
34      * Initializes dumper.
35      *
36      * @param ExtensionManager $extensionManager
37      */
38     public function __construct(ExtensionManager $extensionManager)
39     {
40         $this->extensionManager = $extensionManager;
41
42         parent::__construct('dump-reference');
43     }
44
45     /**
46      * {@inheritdoc}
47      */
48     protected function execute(InputInterface $input, OutputInterface $output)
49     {
50         if (class_exists('Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper')) {
51             $dumper = new YamlReferenceDumper();
52         } else {
53             // Support Symfony Config 2.3
54             $dumper = new ReferenceDumper();
55         }
56
57         $configTree = new ConfigurationTree();
58
59         $output->writeln($dumper->dumpNode($configTree->getConfigTree($this->extensionManager->getExtensions())));
60     }
61 }