Configuration   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A getBundle() 0 4 1
A getConfigTreeBuilder() 0 10 1
1
<?php
2
3
namespace Knp\RadBundle\AppBundle;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10
    private $bundle;
11
    private $treeBuilderFactory;
12
13
    public function __construct(ConfigurableBundleInterface $bundle, TreeBuilderFactory $treeBuilderFactory = null)
14
    {
15
        $this->bundle = $bundle;
16
        $this->treeBuilderFactory = $treeBuilderFactory ?: new TreeBuilderFactory;
17
    }
18
19
    public function getBundle()
20
    {
21
        return $this->bundle;
22
    }
23
24
    public function getConfigTreeBuilder()
25
    {
26
        $treeBuilder = $this->treeBuilderFactory->createTreeBuilder();
27
        $alias       = $this->bundle->getContainerExtension()->getAlias();
28
        $rootNode    = $treeBuilder->root($alias);
29
30
        $this->bundle->buildConfiguration($rootNode);
31
32
        return $treeBuilder;
33
    }
34
}
35