4 * This file is part of the Behat Testwork.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Testwork\Cli;
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;
22 * Extends Symfony console application with testwork functionality.
24 * @author Christophe Coevoet <stof>
26 final class DumpReferenceCommand extends BaseCommand
29 * @var ExtensionManager
31 private $extensionManager;
36 * @param ExtensionManager $extensionManager
38 public function __construct(ExtensionManager $extensionManager)
40 $this->extensionManager = $extensionManager;
42 parent::__construct('dump-reference');
48 protected function execute(InputInterface $input, OutputInterface $output)
50 if (class_exists('Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper')) {
51 $dumper = new YamlReferenceDumper();
53 // Support Symfony Config 2.3
54 $dumper = new ReferenceDumper();
57 $configTree = new ConfigurationTree();
59 $output->writeln($dumper->dumpNode($configTree->getConfigTree($this->extensionManager->getExtensions())));