Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
c 3
b 0
f 1
lcom 1
cbo 3
dl 0
loc 40
ccs 29
cts 29
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
B getConfigTreeBuilder() 0 28 1
1
<?php
2
3
namespace Tpg\ExtjsBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * This is the class that validates and merges configuration from your app/config files
10
 *
11
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    protected $bundles;
16
17 1
    public function __construct($bundles) {
18 1
        $this->bundles = $bundles;
19 1
    }
20
21
    /**
22
     * {@inheritDoc}
23
     */
24 1
    public function getConfigTreeBuilder()
25
    {
26 1
        $treeBuilder = new TreeBuilder();
27 1
        $rootNode = $treeBuilder->root('tpg_extjs');
28
29
        $rootNode
30 3
            ->children()
31 1
                ->arrayNode('remoting')
32 3
                    ->children()
33 5
                        ->arrayNode('bundles')
34 1
                            ->prototype('scalar')
35 3
                                ->validate()
36 4
                                    ->ifNotInArray($this->bundles)
37 2
                                    ->thenInvalid('%s is not a valid bundle.')
38 5
                                ->end()
39 2
                            ->end()
40 5
                        ->end()
41 4
                    ->end()
42 3
                ->end()
43 6
                ->arrayNode('entities')
44 5
                    ->prototype('scalar')
45 4
                    ->end()
46 4
                ->end()
47 3
            ->end()
48 4
        ;
49 3
50 4
        return $treeBuilder;
51 4
    }
52
}
53