| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 55 | 
| Code Lines | 51 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 50 | 
| 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 | 24 | public function getConfigTreeBuilder() | |
| 18 |     { | ||
| 19 | 24 | $treeBuilder = new TreeBuilder; | |
| 20 | 24 |         $root = $treeBuilder->root('innmind_neo4j'); | |
| 21 | |||
| 22 | $root | ||
| 23 | 24 | ->children() | |
| 24 | 24 |                 ->arrayNode('connection') | |
| 25 | 24 | ->addDefaultsIfNotSet() | |
| 26 | 24 | ->children() | |
| 27 | 24 |                         ->scalarNode('host') | |
| 28 | 24 |                             ->defaultValue('localhost') | |
| 29 | 24 | ->end() | |
| 30 | 24 |                         ->scalarNode('scheme') | |
| 31 | 24 |                             ->defaultValue('https') | |
| 32 | 24 | ->end() | |
| 33 | 24 |                         ->integerNode('port') | |
| 34 | 24 | ->defaultValue(7474) | |
| 35 | 24 | ->end() | |
| 36 | 24 |                         ->scalarNode('user') | |
| 37 | 24 |                             ->defaultValue('neo4j') | |
| 38 | 24 | ->end() | |
| 39 | 24 |                         ->scalarNode('password') | |
| 40 | 24 |                             ->defaultValue('neo4j') | |
| 41 | 24 | ->end() | |
| 42 | 24 | ->end() | |
| 43 | 24 | ->end() | |
| 44 | 24 |                 ->arrayNode('types') | |
| 45 | 24 | ->defaultValue([]) | |
| 46 | 24 |                     ->prototype('scalar')->end() | |
| 47 | 24 | ->end() | |
| 48 | 24 |                 ->scalarNode('persister') | |
| 49 | 24 |                     ->info('The service name to use in the unit of work to persist the entity container') | |
| 50 | 24 |                     ->defaultValue('innmind_neo4j.persister.delegation') | |
| 51 | 24 | ->end() | |
| 52 | 24 |                 ->scalarNode('metadata_configuration') | |
| 53 | 24 |                     ->info('The service to use to validate a metadata configuration') | |
| 54 | 24 |                     ->defaultValue('innmind_neo4j.metadata_builder.configuration') | |
| 55 | 24 | ->end() | |
| 56 | 24 |                 ->scalarNode('clock') | |
| 57 | 24 |                     ->info('The clock service to use (instance of TimeContinuumInterface)') | |
| 58 | 24 |                     ->defaultValue('innmind_neo4j.clock') | |
| 59 | 24 | ->end() | |
| 60 | 24 |                 ->scalarNode('event_bus') | |
| 61 | 24 |                     ->info('The event bus service to use for persisters') | |
| 62 | 24 |                     ->defaultValue('innmind_neo4j.event_bus.null') | |
| 63 | 24 | ->end() | |
| 64 | 24 |                 ->scalarNode('dbal_connection') | |
| 65 | 24 |                     ->info('The dbal connection service to use') | |
| 66 | 24 |                     ->defaultValue('innmind_neo4j.dbal.connection.logger') | |
| 67 | 24 | ->end() | |
| 68 | 24 | ->end(); | |
| 69 | |||
| 70 | 24 | return $treeBuilder; | |
| 71 | } | ||
| 72 | } | ||
| 73 |