Conditions | 1 |
Paths | 1 |
Total Lines | 60 |
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 |
||
60 | private function buildConfigTree() |
||
61 | { |
||
62 | $treeBuilder = new TreeBuilder(); |
||
63 | $rootNode = $treeBuilder->root('braincrafted_bootstrap'); |
||
64 | |||
65 | $rootNode |
||
66 | ->children() |
||
67 | ->scalarNode('output_dir')->defaultValue('')->end() |
||
68 | ->scalarNode('assets_dir') |
||
69 | ->defaultValue(self::DEFAULT_ASSETS_DIR) |
||
70 | ->end() |
||
71 | ->scalarNode('fontawesome_dir') |
||
72 | ->defaultValue(self::DEFAULT_FONTAWESOME_DIR) |
||
73 | ->end() |
||
74 | ->scalarNode('jquery_path') |
||
75 | ->defaultValue(self::DEFAULT_JQUERY_PATH) |
||
76 | ->end() |
||
77 | ->scalarNode('fonts_dir') |
||
78 | ->defaultValue(self::DEFAULT_FONTS_DIR) |
||
79 | ->end() |
||
80 | |||
81 | // renamed from css_preprocessor to css_preprocessor |
||
82 | ->scalarNode('css_preprocessor') |
||
83 | ->defaultValue('less') |
||
84 | ->validate() |
||
85 | ->ifNotInArray(array('less', 'lessphp', 'sass', 'scssphp', 'none')) |
||
86 | ->thenInvalid('Invalid less filter "%s"') |
||
87 | ->end() |
||
88 | ->end() |
||
89 | ->scalarNode('icon_prefix') |
||
90 | ->defaultValue('glyphicon') |
||
91 | ->end() |
||
92 | ->scalarNode('icon_tag') |
||
93 | ->defaultValue('span') |
||
94 | ->end() |
||
95 | ->arrayNode('customize') |
||
96 | ->addDefaultsIfNotSet() |
||
97 | ->children() |
||
98 | ->scalarNode('variables_file')->end() |
||
99 | ->scalarNode('bootstrap_output') |
||
100 | ->defaultValue(self::DEFAULT_BOOTSTRAP_OUTPUT) |
||
101 | ->end() |
||
102 | ->scalarNode('bootstrap_template') |
||
103 | ->defaultValue(self::DEFAULT_BOOTSTRAP_TEMPLATE) |
||
104 | ->end() |
||
105 | ->end() |
||
106 | ->end() |
||
107 | ->arrayNode('auto_configure') |
||
108 | ->addDefaultsIfNotSet() |
||
109 | ->children() |
||
110 | ->booleanNode('assetic')->defaultValue(true)->end() |
||
111 | ->booleanNode('twig')->defaultValue(true)->end() |
||
112 | ->booleanNode('knp_menu')->defaultValue(true)->end() |
||
113 | ->booleanNode('knp_paginator')->defaultValue(true)->end() |
||
114 | ->end() |
||
115 | ->end() |
||
116 | ->end(); |
||
117 | |||
118 | return $treeBuilder; |
||
119 | } |
||
120 | } |
||
121 |