| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 51 | 
| Code Lines | 47 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 46 | 
| CRAP Score | 1 | 
| Changes | 2 | ||
| Bugs | 0 | Features | 2 | 
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 | ||
| 17 | 44 | public function getConfigTreeBuilder() | |
| 18 |     { | ||
| 19 | 44 | $treeBuilder = new TreeBuilder; | |
| 20 | 44 |         $root = $treeBuilder->root('innmind_neo4j'); | |
| 21 | |||
| 22 | $root | ||
| 23 | 44 | ->children() | |
| 24 | 44 |                 ->arrayNode('connection') | |
| 25 | 44 | ->addDefaultsIfNotSet() | |
| 26 | 44 | ->children() | |
| 27 | 44 |                         ->scalarNode('host') | |
| 28 | 44 |                             ->defaultValue('localhost') | |
| 29 | 44 | ->end() | |
| 30 | 44 |                         ->scalarNode('scheme') | |
| 31 | 44 |                             ->defaultValue('https') | |
| 32 | 44 | ->end() | |
| 33 | 44 |                         ->integerNode('port') | |
| 34 | 44 | ->defaultValue(7474) | |
| 35 | 44 | ->end() | |
| 36 | 44 |                         ->scalarNode('user') | |
| 37 | 44 |                             ->defaultValue('neo4j') | |
| 38 | 44 | ->end() | |
| 39 | 44 |                         ->scalarNode('password') | |
| 40 | 44 |                             ->defaultValue('neo4j') | |
| 41 | 44 | ->end() | |
| 42 | 44 |                         ->integerNode('timeout') | |
| 43 | 44 | ->defaultValue(60) | |
| 44 | 44 | ->end() | |
| 45 | 44 | ->end() | |
| 46 | 44 | ->end() | |
| 47 | 44 |                 ->arrayNode('types') | |
| 48 | 44 | ->defaultValue([]) | |
| 49 | 44 |                     ->prototype('scalar')->end() | |
| 50 | 44 | ->end() | |
| 51 | 44 |                 ->arrayNode('identity_generators') | |
| 52 | 44 |                     ->info('Identity generators, with keys as identity classes and values as generator service name') | |
| 53 | 44 | ->defaultValue([]) | |
| 54 | 44 |                     ->prototype('scalar')->end() | |
| 55 | 44 | ->end() | |
| 56 | 44 |                 ->scalarNode('persister') | |
| 57 | 44 |                     ->info('The service name to use in the unit of work to persist the entity container') | |
| 58 | 44 |                     ->defaultValue('innmind_neo4j.persister.delegation') | |
| 59 | 44 | ->end() | |
| 60 | 44 |                 ->scalarNode('metadata_configuration') | |
| 61 | 44 |                     ->info('The service to use to validate a metadata configuration') | |
| 62 | 44 |                     ->defaultValue('innmind_neo4j.metadata_builder.configuration') | |
| 63 | 44 | ->end() | |
| 64 | 44 | ->end(); | |
| 65 | |||
| 66 | 44 | return $treeBuilder; | |
| 67 | } | ||
| 68 | } | ||
| 69 |