Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 0 Features 4
Metric Value
wmc 1
c 6
b 0
f 4
lcom 0
cbo 3
dl 0
loc 96
ccs 85
cts 85
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 90 1
1
<?php
2
3
namespace Innmind\ProvisionerBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
use Innmind\ProvisionerBundle\TriggerManager;
8
9
/**
10
 * This is the class that validates and merges configuration from your app/config files
11
 *
12
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
13
 */
14
class Configuration implements ConfigurationInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19 42
    public function getConfigTreeBuilder()
20
    {
21 42
        $treeBuilder = new TreeBuilder();
22 42
        $rootNode = $treeBuilder->root('innmind_provisioner');
23
24
        $rootNode
25 42
            ->children()
26 42
                ->arrayNode('threshold')
27 42
                    ->children()
28 42
                        ->arrayNode('cpu')
29 42
                            ->children()
30 42
                                ->integerNode('max')
31 42
                                    ->defaultValue(100)
32 42
                                    ->min(0)
33 42
                                ->end()
34 42
                                ->integerNode('min')
35 42
                                    ->defaultValue(0)
36 42
                                    ->min(0)
37 42
                                ->end()
38 42
                            ->end()
39 42
                        ->end()
40 42
                        ->arrayNode('load_average')
41 42
                            ->children()
42 42
                                ->floatNode('max')
43 42
                                    ->defaultValue(100)
44 42
                                    ->min(0)
45 42
                                ->end()
46 42
                                ->floatNode('min')
47 42
                                    ->defaultValue(0)
48 42
                                    ->min(0)
49 42
                                ->end()
50 42
                            ->end()
51 42
                        ->end()
52 42
                    ->end()
53 42
                ->end()
54 42
                ->arrayNode('triggers')
55 42
                    ->isRequired()
56 42
                    ->requiresAtLeastOneElement()
57 42
                    ->prototype('scalar')->end()
58 42
                ->end()
59 42
                ->arrayNode('trigger_manager')
60 42
                    ->addDefaultsIfNotSet()
61 42
                    ->children()
62 42
                        ->scalarNode('strategy')
63 42
                            ->defaultValue(TriggerManager::STRATEGY_AFFIRMATIVE)
64 42
                        ->end()
65 42
                        ->booleanNode('allow_if_all_abstain')
66 42
                            ->defaultFalse()
67 42
                        ->end()
68 42
                        ->booleanNode('allow_if_equal_granted_denied')
69 42
                            ->defaultTrue()
70 42
                        ->end()
71 42
                    ->end()
72 42
                ->end()
73 42
                ->arrayNode('alerting')
74 42
                    ->children()
75 42
                        ->scalarNode('email')->end()
76 42
                        ->arrayNode('webhook')
77 42
                            ->prototype('scalar')->end()
78 42
                        ->end()
79 42
                        ->arrayNode('hipchat')
80 42
                            ->children()
81 42
                                ->scalarNode('token')->end()
82 42
                                ->scalarNode('room')->end()
83 42
                            ->end()
84 42
                        ->end()
85 42
                        ->arrayNode('slack')
86 42
                            ->children()
87 42
                                ->scalarNode('token')->end()
88 42
                                ->scalarNode('channel')->end()
89 42
                            ->end()
90 42
                        ->end()
91 42
                    ->end()
92 42
                ->end()
93 42
                ->arrayNode('rabbitmq')
94 42
                    ->children()
95 42
                        ->arrayNode('queue_depth')
96 42
                            ->children()
97 42
                                ->integerNode('history_length')
98 42
                                    ->min(1)
99 42
                                    ->defaultValue(10)
100 42
                                ->end()
101 42
                            ->end()
102 42
                        ->end()
103 42
                    ->end()
104 42
                ->end()
105 42
            ->end();
106
107 42
        return $treeBuilder;
108
    }
109
}
110