Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 72
ccs 0
cts 65
cp 0
rs 10
c 2
b 1
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 66 1
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
                ->scalarNode('command')
26
                    ->defaultValue('process dynamic command')
27
                ->end()
28
                ->arrayNode('mailer')
29
                    ->addDefaultsIfNotSet()
30
                    ->children()
31
                        ->scalarNode('from')->defaultValue('from')->end()
32
                        ->scalarNode('to')->defaultValue('to')->end()
33
                        ->scalarNode('subject')->defaultValue('subject')->end()
34
                    ->end()
35
                ->end()
36
                ->arrayNode('processor')
37
                    ->children()
38
                        ->arrayNode('retry_count')
39
                            ->children()
40
                                ->scalarNode('normal')->defaultValue(1)->end()
41
                                ->scalarNode('critic')->defaultValue(1)->end()
42
                            ->end()
43
                        ->end()
44
                    ->end()
45
                ->end()
46
                ->arrayNode('events')
47
                    ->prototype('array')
48
                        ->children()
49
                            ->enumNode('type')
50
                                ->values(['normal', 'critic'])
51
                                ->defaultValue('normal')
52
                            ->end()
53
                        ->end()
54
                    ->end()
55
                ->end()
56
                ->arrayNode('channels')
57
                    ->addDefaultChildrenIfNoneSet('default')
58
                    ->useAttributeAsKey('name')
59
                    ->prototype('array')
60
                    ->children()
61
                        ->booleanNode('dynamic')
62
                            ->defaultFalse()
63
                        ->end()
64
                        ->integerNode('events_limit_per_run')
65
                            ->defaultNull()
66
                            ->min(0)
67
                        ->end()
68
                        ->integerNode('duration_limit_per_run')
69
                            ->defaultNull()
70
                            ->min(0)
71
                        ->end()
72
                        ->arrayNode('include')
73
                            ->prototype('scalar')->end()
74
                        ->end()
75
                        ->arrayNode('exclude')
76
                            ->prototype('scalar')->end()
77
                        ->end()
78
                    ->end()
79
                ->end()
80
            ->end();
81
82
        return $treeBuilder;
83
    }
84
}
85