Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 13
Bugs 1 Features 7
Metric Value
c 13
b 1
f 7
dl 0
loc 39
rs 8.8571
cc 1
eloc 33
nc 1
nop 0
1
<?php
2
3
namespace Hshn\AngularBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10
    /**
11
     * {@inheritDoc}
12
     */
13
    public function getConfigTreeBuilder()
14
    {
15
        $treeBuilder = new TreeBuilder();
16
17
        $rootNode = $treeBuilder->root('hshn_angular');
18
        $rootNode
19
            ->children()
20
                ->arrayNode('template_cache')
21
                    ->addDefaultsIfNotSet()
22
                    ->children()
23
                        ->scalarNode('dump_path')->defaultValue('%kernel.root_dir%/../web/js/hshn_angular_template_cache.js')->end()
24
                        ->arrayNode('modules')
25
                            ->useAttributeAsKey('key')
26
                            ->prototype('array')
27
                                ->children()
28
                                    ->booleanNode('create')->cannotBeEmpty()->defaultFalse()->info('Generate template caches into the new module. If not, generate into existed one.')->end()
29
                                    ->scalarNode('name')->defaultNull()->end()
30
                                    ->arrayNode('targets')
31
                                        ->beforeNormalization()
32
                                            ->ifString()
33
                                            ->then(function ($v) {
34
                                                return array($v);
35
                                            })
36
                                        ->end()
37
                                        ->isRequired()
38
                                        ->prototype('scalar')->end()
39
                                    ->end()
40
                                ->end()
41
                            ->end()
42
                        ->end()
43
                    ->end()
44
                ->end()
45
                ->arrayNode('assetic')
46
                ->end()
47
            ->end()
48
        ;
49
50
        return $treeBuilder;
51
    }
52
}
53