| Conditions | 1 |
| Paths | 1 |
| Total Lines | 58 |
| Code Lines | 55 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 18 | public function getConfigTreeBuilder() |
||
| 19 | { |
||
| 20 | $treeBuilder = new TreeBuilder(); |
||
| 21 | $rootNode = $treeBuilder->root('nvbooster_assets'); |
||
| 22 | $rootNode |
||
| 23 | ->children() |
||
| 24 | ->arrayNode('phpcr') |
||
| 25 | ->addDefaultsIfNotSet() |
||
| 26 | ->children() |
||
| 27 | ->scalarNode('root_path') |
||
| 28 | ->info('Defines path in PHPCR tree for assets to store in') |
||
| 29 | ->defaultValue('') |
||
| 30 | ->end() |
||
| 31 | ->end() |
||
| 32 | ->end() |
||
| 33 | ->arrayNode('filters') |
||
| 34 | ->addDefaultsIfNotSet() |
||
| 35 | ->info('Defines default filters for asset types') |
||
| 36 | ->fixXmlConfig('filter', 'css') |
||
| 37 | ->fixXmlConfig('filter', 'js') |
||
| 38 | ->children() |
||
| 39 | ->arrayNode('css') |
||
| 40 | ->addDefaultsIfNotSet() |
||
| 41 | ->end() |
||
| 42 | ->arrayNode('js') |
||
| 43 | ->addDefaultsIfNotSet() |
||
| 44 | ->end() |
||
| 45 | ->end() |
||
| 46 | ->end() |
||
| 47 | ->arrayNode('routing') |
||
| 48 | ->addDefaultsIfNotSet() |
||
| 49 | ->children() |
||
| 50 | ->scalarNode('base_uri') |
||
| 51 | ->info('Defines base uri for routes generated') |
||
| 52 | ->defaultValue('assets') |
||
| 53 | ->end() |
||
| 54 | ->end() |
||
| 55 | ->end() |
||
| 56 | ->arrayNode('codemirror') |
||
| 57 | ->info('Configuring codemirror js library (external)') |
||
| 58 | ->children() |
||
| 59 | ->arrayNode('paths') |
||
| 60 | ->children() |
||
| 61 | ->scalarNode('js')->end() |
||
| 62 | ->scalarNode('css')->end() |
||
| 63 | ->scalarNode('modes_dir')->end() |
||
| 64 | ->scalarNode('themes_dir')->end() |
||
| 65 | ->end() |
||
| 66 | ->end() |
||
| 67 | ->arrayNode('options') |
||
| 68 | ->prototype('scalar')->end() |
||
| 69 | ->end() |
||
| 70 | ->end() |
||
| 71 | ->end() |
||
| 72 | ->end(); |
||
| 73 | |||
| 74 | return $treeBuilder; |
||
| 75 | } |
||
| 76 | } |
||
| 77 |