Conditions | 1 |
Paths | 1 |
Total Lines | 88 |
Code Lines | 76 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
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 |
||
116 | protected function configurePlugins(ArrayNodeDefinition $root) |
||
117 | { |
||
118 | $root->children() |
||
119 | ->arrayNode('plugins') |
||
120 | ->addDefaultsIfNotSet() |
||
121 | ->children() |
||
122 | |||
123 | ->arrayNode('authentication') |
||
124 | ->canBeEnabled() |
||
125 | ->children() |
||
126 | ->scalarNode('authentication')->isRequired()->cannotBeEmpty()->end() |
||
127 | ->end() |
||
128 | ->end() // End authentication plugin |
||
129 | |||
130 | ->arrayNode('cache') |
||
131 | ->canBeEnabled() |
||
132 | ->addDefaultsIfNotSet() |
||
133 | ->children() |
||
134 | ->scalarNode('cache_pool')->isRequired()->cannotBeEmpty()->end() |
||
135 | ->scalarNode('stream_factory')->cannotBeEmpty()->defaultValue('httplug.stream_factory')->end() |
||
136 | ->arrayNode('config') |
||
137 | ->children() |
||
138 | ->scalarNode('default_ttl')->defaultNull()->end() |
||
139 | ->scalarNode('respect_cache_headers')->defaultTrue()->end() |
||
140 | ->end() |
||
141 | ->end() |
||
142 | ->end() |
||
143 | ->end() // End cache plugin |
||
144 | |||
145 | ->arrayNode('cookie') |
||
146 | ->canBeEnabled() |
||
147 | ->children() |
||
148 | ->scalarNode('cookie_jar')->isRequired()->cannotBeEmpty()->end() |
||
149 | ->end() |
||
150 | ->end() // End cookie plugin |
||
151 | |||
152 | ->arrayNode('decoder') |
||
153 | ->canBeDisabled() |
||
154 | ->addDefaultsIfNotSet() |
||
155 | ->children() |
||
156 | ->scalarNode('use_content_encoding')->defaultTrue()->end() |
||
157 | ->end() |
||
158 | ->end() // End decoder plugin |
||
159 | |||
160 | ->arrayNode('history') |
||
161 | ->canBeEnabled() |
||
162 | ->children() |
||
163 | ->scalarNode('journal')->isRequired()->cannotBeEmpty()->end() |
||
164 | ->end() |
||
165 | ->end() // End history plugin |
||
166 | |||
167 | ->arrayNode('logger') |
||
168 | ->canBeDisabled() |
||
169 | ->addDefaultsIfNotSet() |
||
170 | ->children() |
||
171 | ->scalarNode('logger')->isRequired()->cannotBeEmpty()->defaultValue('logger')->end() |
||
172 | ->scalarNode('formatter')->defaultNull()->end() |
||
173 | ->end() |
||
174 | ->end() // End logger plugin |
||
175 | |||
176 | ->arrayNode('redirect') |
||
177 | ->canBeDisabled() |
||
178 | ->addDefaultsIfNotSet() |
||
179 | ->children() |
||
180 | ->scalarNode('preserve_header')->defaultTrue()->end() |
||
181 | ->scalarNode('use_default_for_multiple')->defaultTrue()->end() |
||
182 | ->end() |
||
183 | ->end() // End redirect plugin |
||
184 | |||
185 | ->arrayNode('retry') |
||
186 | ->canBeDisabled() |
||
187 | ->addDefaultsIfNotSet() |
||
188 | ->children() |
||
189 | ->scalarNode('retry')->defaultValue(1)->end() |
||
190 | ->end() |
||
191 | ->end() // End retry plugin |
||
192 | |||
193 | ->arrayNode('stopwatch') |
||
194 | ->canBeEnabled() |
||
195 | ->children() |
||
196 | ->scalarNode('stopwatch')->isRequired()->cannotBeEmpty()->end() |
||
197 | ->end() |
||
198 | ->end() // End stopwatch plugin |
||
199 | |||
200 | ->end() |
||
201 | ->end() |
||
202 | ->end(); |
||
203 | } |
||
204 | } |
||
205 |