Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
rs 9.4286
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2015 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace SpomkyLabs\IpFilterBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
class Configuration implements ConfigurationInterface
18
{
19
    private $alias;
20
21
    /**
22
     * @param string $alias
23
     */
24
    public function __construct($alias)
25
    {
26
        $this->alias = $alias;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function getConfigTreeBuilder()
33
    {
34
        $treeBuilder = new TreeBuilder();
35
        $rootNode = $treeBuilder->root($this->alias);
36
37
        $rootNode
38
            ->children()
39
                ->scalarNode('ip_class')->isRequired()->cannotBeEmpty()->end()
40
                ->scalarNode('ip_manager')->defaultValue('sl_ip_filter.ip_manager.default')->end()
41
42
                ->scalarNode('range_class')->isRequired()->cannotBeEmpty()->end()
43
                ->scalarNode('range_manager')->defaultValue('sl_ip_filter.range_manager.default')->end()
44
            ->end();
45
46
        return $treeBuilder;
47
    }
48
}
49