| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 67 | 
| Code Lines | 56 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 36 | 
| CRAP Score | 1 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 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 |