TreeBuilder   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTree() 0 64 1
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Application\Config;
11
12
/**
13
 * Builds Tree of configuration
14
 *
15
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
16
 */
17
class TreeBuilder implements \Hal\Component\Config\TreeBuilderInterface
18
{
19
20
    /**
21
     * Get the tree used for the application
22
     *
23
     * @return \Symfony\Component\Config\Definition\NodeInterface
24
     */
25
    public function getTree() {
26
        $treeBuilder = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
27
        $rootNode = $treeBuilder->root('phpmetrics');
28
29
        $rootNode
30
            ->children()
31
                ->arrayNode('rules')
32
                    ->useAttributeAsKey('rulename')
33
                    ->prototype('array')
34
                        ->children()
35
                            ->scalarNode('0')->end()
36
                            ->scalarNode('1')->end()
37
                            ->scalarNode('2')->end()
38
                        ->end()
39
                    ->end()
40
                ->end()
41
                ->scalarNode('failure')
42
                    ->defaultValue(null)
43
                ->end()
44
                ->arrayNode('path')
45
                    ->addDefaultsIfNotSet()
46
                    ->children()
47
                        ->scalarNode('directory')->defaultValue(null)->end()
48
                        ->scalarNode('exclude')->defaultValue('Tests|tests|Features|features|\.svn|\.git|vendor')->end()
49
                        ->scalarNode('extensions')->defaultValue('php|inc')->end()
50
                        ->booleanNode('symlinks')->defaultValue(false)->end()
51
                    ->end()
52
                ->end()
53
                ->booleanNode('ignore-errors')->defaultValue(false)->end()
54
                ->arrayNode('logging')
55
                    ->addDefaultsIfNotSet()
56
                    ->children()
57
                        ->arrayNode('report')
58
                            ->children()
59
                                ->scalarNode('html')->defaultValue(null)->end()
60
                                ->scalarNode('xml')->defaultValue(null)->end()
61
                                ->scalarNode('csv')->defaultValue(null)->end()
62
                                ->scalarNode('json')->defaultValue(null)->end()
63
                                ->scalarNode('cli')->defaultValue(null)->end()
64
                            ->end()
65
                        ->end()
66
                        ->arrayNode('violations')
67
                            ->children()
68
                                ->scalarNode('xml')->defaultValue(null)->end()
69
                            ->end()
70
                        ->end()
71
                        ->arrayNode('chart')
72
                            ->children()
73
                                ->scalarNode('bubbles')->defaultValue(null)->end()
74
                            ->end()
75
                        ->end()
76
                    ->end()
77
                ->end()
78
                ->arrayNode('template')
79
                    ->addDefaultsIfNotSet()
80
                    ->children()
81
                        ->scalarNode('title')->defaultValue('PhpMetrics report')
82
                    ->end()
83
                ->end()
84
            ->end()
85
        ;
86
87
        return $treeBuilder->buildTree();
88
    }
89
}