Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 36
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 9 1
A addConsoleSection() 0 11 1
1
<?php
2
3
/*
4
 * This file is part of the Social Live project.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace AMF\ConsoleBundle\DependencyInjection;
11
12
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
16
/**
17
 * Class Configuration.
18
 *
19
 * @author Amine Fattouch <[email protected]>
20
 */
21
class Configuration implements ConfigurationInterface
22
{
23
    /**
24
     * Generates the configuration tree builder.
25
     *
26
     * @return TreeBuilder The tree builder
27
     */
28
    public function getConfigTreeBuilder()
29
    {
30
        $treeBuilder = new TreeBuilder();
31
32
        $rootNode = $treeBuilder->root('amf_console');
33
        $this->addConsoleSection($rootNode);
34
35
        return $treeBuilder;
36
    }
37
38
    /**
39
     * Adds the config of prefixes to global config.
40
     *
41
     * @param ArrayNodeDefinition $node The root element for the config nodes.
42
     *
43
     * @return void
44
     */
45
    protected function addConsoleSection(ArrayNodeDefinition $node)
46
    {
47
        $node->fixXmlConfig('allowed_prefix')
48
            ->children()
49
                ->arrayNode('allowed_prefixes')
50
                    ->isRequired()
51
                    ->cannotBeEmpty()
52
                    ->prototype('scalar')->end()
53
                ->end()
54
            ->end();
55
    }
56
}
57