Completed
Push — master ( b2bb70...dcbb39 )
by Artem
02:24
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 19
cts 19
cp 1
rs 8.9713
c 0
b 0
f 0
cc 1
eloc 20
nc 1
nop 0
crap 1
1
<?php
2
3
//----------------------------------------------------------------------
4
//
5
//  Copyright (C) 2017 Artem Rodygin
6
//
7
//  You should have received a copy of the MIT License along with
8
//  this file. If not, see <http://opensource.org/licenses/MIT>.
9
//
10
//----------------------------------------------------------------------
11
12
namespace Pignus\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * Validates and merges configuration from app/config files.
19
 *
20
 * @see http://symfony.com/doc/current/cookbook/bundles/configuration.html
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 5
    public function getConfigTreeBuilder()
28
    {
29 5
        $treeBuilder = new TreeBuilder();
30 5
        $rootNode    = $treeBuilder->root('pignus');
31
32
        $rootNode
33 5
            ->children()
34 5
                ->integerNode('auth_failures')
35 5
                    ->defaultNull()
36 5
                ->end()
37 5
                ->integerNode('lock_duration')
38 5
                    ->defaultNull()
39 5
                ->end()
40 5
                ->booleanNode('unauthorized_request')
41 5
                    ->defaultFalse()
42 5
                ->end()
43 5
                ->arrayNode('login')
44 5
                    ->requiresAtLeastOneElement()
45 5
                    ->prototype('scalar')->end()
46 5
                ->end()
47 5
            ->end();
48
49 5
        return $treeBuilder;
50
    }
51
}
52