Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 30
nc 1
nop 0
1
<?php
2
3
namespace Rezzza\SecurityBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * Configuration
10
 *
11
 * @uses ConfigurationInterface
12
 * @author Stephane PY <[email protected]>
13
 */
14
class Configuration implements ConfigurationInterface
15
{
16
    /**
17
     * Generates the configuration tree builder.
18
     *
19
     * @return TreeBuilder The tree builder
20
     */
21
    public function getConfigTreeBuilder()
22
    {
23
        $tb       = new TreeBuilder();
24
        $rootNode = $tb->root('rezzza_security');
25
26
        $rootNode
27
            ->children()
28
                ->arrayNode('request_obfuscator')
29
                    ->addDefaultsIfNotSet()
30
                    ->children()
31
                        ->booleanNode('enabled')->defaultFalse()->end()
32
                    ->end()
33
                ->end()
34
                ->arrayNode('firewalls')
35
                    ->useAttributeAsKey('name')
36
                    ->prototype('array')
37
                        ->children()
38
                            ->scalarNode('algorithm')
39
                                ->defaultValue('SHA1')
40
                            ->end()
41
                            ->scalarNode('secret')
42
                                ->isRequired()
43
                                ->cannotBeEmpty()
44
                            ->end()
45
                            ->booleanNode('replay_protection')
46
                                ->defaultValue(true)
47
                            ->end()
48
                        ->end()
49
                    ->end()
50
                ->end()
51
            ->end()
52
            ;
53
54
        return $tb;
55
    }
56
}
57