Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 67 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\HomeostasisBundle\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\{
7
    Builder\TreeBuilder,
8
    ConfigurationInterface
9
};
10
11
final class Configuration implements ConfigurationInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 2
    public function getConfigTreeBuilder()
17
    {
18 2
        $treeBuilder = new TreeBuilder;
19 2
        $root = $treeBuilder->root('innmind_homeostasis');
20
21
        $root
22 2
            ->children()
23 2
                ->arrayNode('factors')
24 2
                    ->requiresAtLeastOneElement()
25 2
                    ->defaultValue([
26 2
                        'cpu' => [
27
                            'weight' => 0.7,
28
                            'polynom' => [
29
                                'intercept' => -0.0012195890835040666,
30
                                'degrees' => [
31
                                    1 => 2.0996410102652,
32
                                    2 => -17.27684076838,
33
                                    3 => 86.261146237871,
34
                                    4 => -189.7736029403,
35
                                    5 => 184.66906744449,
36
                                    6 => -64.975065630889,
37
                                ],
38
                            ],
39
                        ],
40
                        'log' => [
41
                            'weight' => 0.3,
42
                            'polynom' => [
43
                                'intercept' => -5.03E-8,
44
                                'degrees' => [
45
                                    1 => 12.4035,
46
                                    2 => -52.3392,
47
                                    3 => 87.7193,
48
                                    4 => -46.7836,
49
                                ],
50
                            ]
51
                        ],
52
                    ])
53 2
                    ->prototype('array')->end()
54 2
                ->end()
55 2
                ->arrayNode('regulator_stack')
56 2
                    ->requiresAtLeastOneElement()
57 2
                    ->defaultValue(['thread_safe', 'modulate_state_history', 'default'])
58 2
                    ->prototype('scalar')->end()
59 2
                ->end()
60 2
                ->scalarNode('strategy_determinator')
61 2
                    ->defaultValue('innmind.homeostasis.strategy_determinator.default')
62 2
                ->end()
63 2
                ->scalarNode('actuator')
64 2
                    ->info('Service id of the actuator')
65 2
                    ->cannotBeEmpty()
66 2
                ->end()
67 2
                ->scalarNode('state_history')
68 2
                    ->defaultValue('%kernel.root_dir%/../var/data/innmind/homeostasis/states')
69 2
                ->end()
70 2
                ->scalarNode('action_history')
71 2
                    ->defaultValue('%kernel.root_dir%/../var/data/innmind/homeostasis/actions')
72 2
                ->end()
73 2
                ->scalarNode('max_history')
74 2
                    ->defaultValue(24 * 60 * 60 * 1000) //one day
75 2
                ->end()
76 2
                ->scalarNode('min_history')
77 2
                    ->defaultValue(60 * 60 * 1000) //one hour
78 2
                ->end()
79 2
            ->end();
80
81 2
        return $treeBuilder;
82
    }
83
}
84