ConfigurationTree   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
c 3
b 0
f 1
lcom 1
cbo 3
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getConfigTreeBuilder() 0 15 2
1
<?php
2
3
namespace Openl10n\Cli\ServiceContainer\Configuration;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class ConfigurationTree implements ConfigurationInterface
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $extensions;
14
15
    public function __construct(array $extensions)
16
    {
17
        $this->extensions = $extensions;
18
    }
19
20
    /**
21
     * @return TreeBuilder
22
     */
23
    public function getConfigTreeBuilder()
24
    {
25
        $treeBuilder = new TreeBuilder();
26
        $rootNode = $treeBuilder->root('openl10n');
27
28
        foreach ($this->extensions as $extension) {
29
            $rootName = $extension->getName();
30
31
            $node = $rootNode->children()->arrayNode($rootName);
32
33
            $extension->configure($node);
34
        }
35
36
        return $treeBuilder;
37
    }
38
}
39