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