Completed
Pull Request — master (#11)
by Clément
04:00 queued 33s
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 44
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 44
ccs 0
cts 43
cp 0
rs 8.8571
cc 1
eloc 41
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Itkg\DelayEventBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * This is the class that validates and merges configuration from your app/config files
10
 *
11
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function getConfigTreeBuilder()
19
    {
20
        $treeBuilder = new TreeBuilder();
21
        $rootNode = $treeBuilder->root('itkg_delay_event');
22
        $rootNode
23
            ->fixXmlConfig('channel')
24
            ->children()
25
                ->arrayNode('processor')
26
                    ->children()
27
                        ->arrayNode('retry_count')
28
                            ->children()
29
                                ->scalarNode('normal')->defaultValue(1)->end()
30
                                ->scalarNode('critic')->defaultValue(1)->end()
31
                            ->end()
32
                        ->end()
33
                    ->end()
34
                ->end()
35
                ->arrayNode('events')
36
                    ->prototype('array')
37
                        ->children()
38
                            ->enumNode('type')
39
                                ->values(['normal', 'critic'])
40
                                ->defaultValue('normal')
41
                            ->end()
42
                        ->end()
43
                    ->end()
44
                ->end()
45
                ->arrayNode('channels')
46
                    ->addDefaultChildrenIfNoneSet('default')
47
                    ->useAttributeAsKey('name')
48
                    ->prototype('array')
49
                    ->children()
50
                        ->arrayNode('include')
51
                            ->prototype('scalar')->end()
52
                        ->end()
53
                        ->arrayNode('exclude')
54
                            ->prototype('scalar')->end()
55
                        ->end()
56
                    ->end()
57
                ->end()
58
            ->end();
59
60
        return $treeBuilder;
61
    }
62
}
63