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\ServiceContainer\Configuration;
13 use Behat\Testwork\ServiceContainer\Extension;
14 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15 use Symfony\Component\Config\Definition\NodeInterface;
18 * Builds configuration tree using provided lists of core and custom extensions.
20 * @author Konstantin Kudryashov <ever.zet@gmail.com>
22 final class ConfigurationTree
25 * Generates the configuration tree.
27 * @param Extension[] $extensions
29 * @return NodeInterface
31 public function getConfigTree(array $extensions)
33 $tree = new TreeBuilder();
34 $root = $tree->root('testwork');
36 foreach ($extensions as $extension) {
37 $extension->configure($root->children()->arrayNode($extension->getConfigKey()));
40 return $tree->buildTree();