Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getConfigTreeBuilder() 0 16 1
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