Conditions | 1 |
Paths | 1 |
Total Lines | 120 |
Code Lines | 108 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
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 |
||
117 | protected function configurePlugins(ArrayNodeDefinition $root) |
||
118 | { |
||
119 | $root->children() |
||
120 | ->arrayNode('plugins') |
||
121 | ->addDefaultsIfNotSet() |
||
122 | ->children() |
||
123 | |||
124 | ->arrayNode('authentication') |
||
125 | ->canBeEnabled() |
||
126 | ->children() |
||
127 | ->scalarNode('authentication') |
||
128 | ->info('This must be a service id to a service implementing Http\Message\Authentication') |
||
129 | ->isRequired() |
||
130 | ->cannotBeEmpty() |
||
131 | ->end() |
||
132 | ->end() |
||
133 | ->end() // End authentication plugin |
||
134 | |||
135 | ->arrayNode('cache') |
||
136 | ->canBeEnabled() |
||
137 | ->addDefaultsIfNotSet() |
||
138 | ->children() |
||
139 | ->scalarNode('cache_pool') |
||
140 | ->info('This must be a service id to a service implementing Psr\Cache\CacheItemPoolInterface') |
||
141 | ->isRequired() |
||
142 | ->cannotBeEmpty() |
||
143 | ->end() |
||
144 | ->scalarNode('stream_factory') |
||
145 | ->info('This must be a service id to a service implementing Http\Message\StreamFactory') |
||
146 | ->defaultValue('httplug.stream_factory') |
||
147 | ->cannotBeEmpty() |
||
148 | ->end() |
||
149 | ->arrayNode('config') |
||
150 | ->children() |
||
151 | ->scalarNode('default_ttl')->defaultNull()->end() |
||
152 | ->scalarNode('respect_cache_headers')->defaultTrue()->end() |
||
153 | ->end() |
||
154 | ->end() |
||
155 | ->end() |
||
156 | ->end() // End cache plugin |
||
157 | |||
158 | ->arrayNode('cookie') |
||
159 | ->canBeEnabled() |
||
160 | ->children() |
||
161 | ->scalarNode('cookie_jar') |
||
162 | ->info('This must be a service id to a service implementing Http\Message\CookieJar') |
||
163 | ->isRequired() |
||
164 | ->cannotBeEmpty() |
||
165 | ->end() |
||
166 | ->end() |
||
167 | ->end() // End cookie plugin |
||
168 | |||
169 | ->arrayNode('decoder') |
||
170 | ->canBeDisabled() |
||
171 | ->addDefaultsIfNotSet() |
||
172 | ->children() |
||
173 | ->scalarNode('use_content_encoding')->defaultTrue()->end() |
||
174 | ->end() |
||
175 | ->end() // End decoder plugin |
||
176 | |||
177 | ->arrayNode('history') |
||
178 | ->canBeEnabled() |
||
179 | ->children() |
||
180 | ->scalarNode('journal') |
||
181 | ->info('This must be a service id to a service implementing Http\Client\Plugin\Journal') |
||
182 | ->isRequired() |
||
183 | ->cannotBeEmpty() |
||
184 | ->end() |
||
185 | ->end() |
||
186 | ->end() // End history plugin |
||
187 | |||
188 | ->arrayNode('logger') |
||
189 | ->canBeDisabled() |
||
190 | ->addDefaultsIfNotSet() |
||
191 | ->children() |
||
192 | ->scalarNode('logger') |
||
193 | ->info('This must be a service id to a service implementing Psr\Log\LoggerInterface') |
||
194 | ->defaultValue('logger') |
||
195 | ->cannotBeEmpty() |
||
196 | ->end() |
||
197 | ->scalarNode('formatter') |
||
198 | ->info('This must be a service id to a service implementing Http\Message\Formatter') |
||
199 | ->defaultNull() |
||
200 | ->end() |
||
201 | ->end() |
||
202 | ->end() // End logger plugin |
||
203 | |||
204 | ->arrayNode('redirect') |
||
205 | ->canBeDisabled() |
||
206 | ->addDefaultsIfNotSet() |
||
207 | ->children() |
||
208 | ->scalarNode('preserve_header')->defaultTrue()->end() |
||
209 | ->scalarNode('use_default_for_multiple')->defaultTrue()->end() |
||
210 | ->end() |
||
211 | ->end() // End redirect plugin |
||
212 | |||
213 | ->arrayNode('retry') |
||
214 | ->canBeDisabled() |
||
215 | ->addDefaultsIfNotSet() |
||
216 | ->children() |
||
217 | ->scalarNode('retry')->defaultValue(1)->end() |
||
218 | ->end() |
||
219 | ->end() // End retry plugin |
||
220 | |||
221 | ->arrayNode('stopwatch') |
||
222 | ->canBeDisabled() |
||
223 | ->addDefaultsIfNotSet() |
||
224 | ->children() |
||
225 | ->scalarNode('stopwatch') |
||
226 | ->info('This must be a service id to a service extending Symfony\Component\Stopwatch\Stopwatch') |
||
227 | ->defaultValue('debug.stopwatch') |
||
228 | ->cannotBeEmpty() |
||
229 | ->end() |
||
230 | ->end() |
||
231 | ->end() // End stopwatch plugin |
||
232 | |||
233 | ->end() |
||
234 | ->end() |
||
235 | ->end(); |
||
236 | } |
||
237 | } |
||
238 |