Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / ServiceContainer / Configuration / ConfigurationTree.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\ServiceContainer\Configuration;
12
13 use Behat\Testwork\ServiceContainer\Extension;
14 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15 use Symfony\Component\Config\Definition\NodeInterface;
16
17 /**
18  * Builds configuration tree using provided lists of core and custom extensions.
19  *
20  * @author Konstantin Kudryashov <ever.zet@gmail.com>
21  */
22 final class ConfigurationTree
23 {
24     /**
25      * Generates the configuration tree.
26      *
27      * @param Extension[] $extensions
28      *
29      * @return NodeInterface
30      */
31     public function getConfigTree(array $extensions)
32     {
33         $tree = new TreeBuilder();
34         $root = $tree->root('testwork');
35
36         foreach ($extensions as $extension) {
37             $extension->configure($root->children()->arrayNode($extension->getConfigKey()));
38         }
39
40         return $tree->buildTree();
41     }
42 }