| Conditions | 1 |
| Paths | 1 |
| Total Lines | 59 |
| Code Lines | 55 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 8 | ||
| Bugs | 0 | Features | 5 |
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 |
||
| 25 | public function getConfigTreeBuilder() |
||
| 26 | { |
||
| 27 | $treeBuilder = new TreeBuilder(); |
||
| 28 | $rootNode = $treeBuilder->root('sonata_translation'); |
||
| 29 | |||
| 30 | $rootNode |
||
| 31 | ->children() |
||
| 32 | ->arrayNode('locales') |
||
| 33 | ->info('The list of your frontend locales in which your models will be translatable.') |
||
| 34 | ->requiresAtLeastOneElement() |
||
| 35 | ->prototype('scalar')->end() |
||
| 36 | ->end() |
||
| 37 | ->scalarNode('default_locale') |
||
| 38 | ->defaultValue('en') |
||
| 39 | ->info('The frontend locale that is used by default.') |
||
| 40 | ->end() |
||
| 41 | ->arrayNode('gedmo') |
||
| 42 | ->canBeEnabled() |
||
| 43 | ->children() |
||
| 44 | ->arrayNode('implements') |
||
| 45 | ->requiresAtLeastOneElement() |
||
| 46 | ->prototype('scalar')->end() |
||
| 47 | ->end() |
||
| 48 | ->arrayNode('instanceof') |
||
| 49 | ->requiresAtLeastOneElement() |
||
| 50 | ->prototype('scalar')->end() |
||
| 51 | ->end() |
||
| 52 | ->end() |
||
| 53 | ->end() |
||
| 54 | ->arrayNode('knplabs') |
||
| 55 | ->canBeEnabled() |
||
| 56 | ->children() |
||
| 57 | ->arrayNode('implements') |
||
| 58 | ->requiresAtLeastOneElement() |
||
| 59 | ->prototype('scalar')->end() |
||
| 60 | ->end() |
||
| 61 | ->arrayNode('instanceof') |
||
| 62 | ->requiresAtLeastOneElement() |
||
| 63 | ->prototype('scalar')->end() |
||
| 64 | ->end() |
||
| 65 | ->end() |
||
| 66 | ->end() |
||
| 67 | ->arrayNode('phpcr') |
||
| 68 | ->canBeEnabled() |
||
| 69 | ->children() |
||
| 70 | ->arrayNode('implements') |
||
| 71 | ->requiresAtLeastOneElement() |
||
| 72 | ->prototype('scalar')->end() |
||
| 73 | ->end() |
||
| 74 | ->arrayNode('instanceof') |
||
| 75 | ->requiresAtLeastOneElement() |
||
| 76 | ->prototype('scalar')->end() |
||
| 77 | ->end() |
||
| 78 | ->end() |
||
| 79 | ->end() |
||
| 80 | ->end(); |
||
| 81 | |||
| 82 | return $treeBuilder; |
||
| 83 | } |
||
| 84 | } |
||
| 85 |