* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Behat\Testwork\ServiceContainer\Configuration; use Behat\Testwork\ServiceContainer\Extension; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\NodeInterface; /** * Builds configuration tree using provided lists of core and custom extensions. * * @author Konstantin Kudryashov */ final class ConfigurationTree { /** * Generates the configuration tree. * * @param Extension[] $extensions * * @return NodeInterface */ public function getConfigTree(array $extensions) { $tree = new TreeBuilder(); $root = $tree->root('testwork'); foreach ($extensions as $extension) { $extension->configure($root->children()->arrayNode($extension->getConfigKey())); } return $tree->buildTree(); } }