| Conditions | 1 |
| Paths | 1 |
| Total Lines | 55 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 64 | protected function getApplicationNode() |
||
| 65 | { |
||
| 66 | $builder = new TreeBuilder(); |
||
| 67 | $node = $builder->root('application'); |
||
| 68 | |||
| 69 | $node |
||
| 70 | ->children() |
||
| 71 | ->scalarNode('title')->end() |
||
| 72 | ->scalarNode('description')->end() |
||
| 73 | ->scalarNode('base_template')->end() |
||
| 74 | ->scalarNode('date_format')->defaultValue('Y-m-d')->end() |
||
| 75 | ->scalarNode('bootstrap')->end() |
||
| 76 | ->scalarNode('max_per_page')->end() |
||
| 77 | ->scalarNode('routing_name_pattern')->end() |
||
| 78 | ->scalarNode('routing_url_pattern')->end() |
||
| 79 | ->booleanNode('translation')->end() |
||
| 80 | ->scalarNode('translation_pattern')->end() |
||
| 81 | ->scalarNode('block_template') |
||
| 82 | ->defaultValue('LAGAdminBundle:Form:fields.html.twig') |
||
| 83 | ->end() |
||
| 84 | ->arrayNode('fields_mapping') |
||
| 85 | ->prototype('scalar') |
||
| 86 | ->end() |
||
| 87 | ->end() |
||
| 88 | ->booleanNode('enable_extra_configuration')->end() |
||
| 89 | ->booleanNode('enable_security')->end() |
||
| 90 | ->booleanNode('enable_menus')->end() |
||
| 91 | ->booleanNode('enable_homepage')->end() |
||
| 92 | ->booleanNode('translation')->end() |
||
| 93 | ->variableNode('translation_pattern')->end() |
||
| 94 | ->scalarNode('title')->end() |
||
| 95 | ->scalarNode('description')->end() |
||
| 96 | ->scalarNode('locale')->end() |
||
| 97 | ->scalarNode('base_template')->end() |
||
| 98 | ->scalarNode('block_template')->end() |
||
| 99 | ->scalarNode('menu_template')->end() |
||
| 100 | ->scalarNode('homepage_template')->end() |
||
| 101 | ->scalarNode('homepage_route')->end() |
||
| 102 | ->scalarNode('routing_url_pattern')->end() |
||
| 103 | ->scalarNode('routing_name_pattern')->end() |
||
| 104 | ->scalarNode('bootstrap')->end() |
||
| 105 | ->scalarNode('date_format')->end() |
||
| 106 | ->scalarNode('pager')->end() |
||
| 107 | ->scalarNode('string_length')->end() |
||
| 108 | ->scalarNode('string_length_truncate')->end() |
||
| 109 | ->scalarNode('max_per_page')->end() |
||
| 110 | ->scalarNode('admin_class')->end() |
||
| 111 | ->scalarNode('action_class')->end() |
||
| 112 | ->scalarNode('permissions')->end() |
||
| 113 | ->scalarNode('page_parameter')->end() |
||
| 114 | ->end() |
||
| 115 | ->end(); |
||
| 116 | |||
| 117 | return $node; |
||
| 118 | } |
||
| 119 | |||
| 136 |