| Conditions | 1 |
| Paths | 1 |
| Total Lines | 116 |
| Code Lines | 104 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 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')->cannotBeEmpty()->defaultValue('httplug.stream_factory')->end() |
||
| 145 | ->arrayNode('config') |
||
| 146 | ->children() |
||
| 147 | ->scalarNode('default_ttl')->defaultNull()->end() |
||
| 148 | ->scalarNode('respect_cache_headers')->defaultTrue()->end() |
||
| 149 | ->end() |
||
| 150 | ->end() |
||
| 151 | ->end() |
||
| 152 | ->end() // End cache plugin |
||
| 153 | |||
| 154 | ->arrayNode('cookie') |
||
| 155 | ->canBeEnabled() |
||
| 156 | ->children() |
||
| 157 | ->scalarNode('cookie_jar') |
||
| 158 | ->info('This must be a service id to a service implementing Http\Message\CookieJar') |
||
| 159 | ->isRequired() |
||
| 160 | ->cannotBeEmpty() |
||
| 161 | ->end() |
||
| 162 | ->end() |
||
| 163 | ->end() // End cookie plugin |
||
| 164 | |||
| 165 | ->arrayNode('decoder') |
||
| 166 | ->canBeDisabled() |
||
| 167 | ->addDefaultsIfNotSet() |
||
| 168 | ->children() |
||
| 169 | ->scalarNode('use_content_encoding')->defaultTrue()->end() |
||
| 170 | ->end() |
||
| 171 | ->end() // End decoder plugin |
||
| 172 | |||
| 173 | ->arrayNode('history') |
||
| 174 | ->canBeEnabled() |
||
| 175 | ->children() |
||
| 176 | ->scalarNode('journal') |
||
| 177 | ->info('This must be a service id to a service implementing Http\Client\Plugin\Journal') |
||
| 178 | ->isRequired() |
||
| 179 | ->cannotBeEmpty() |
||
| 180 | ->end() |
||
| 181 | ->end() |
||
| 182 | ->end() // End history plugin |
||
| 183 | |||
| 184 | ->arrayNode('logger') |
||
| 185 | ->canBeDisabled() |
||
| 186 | ->addDefaultsIfNotSet() |
||
| 187 | ->children() |
||
| 188 | ->scalarNode('logger') |
||
| 189 | ->info('This must be a service id to a service implementing Psr\Log\LoggerInterface') |
||
| 190 | ->defaultValue('logger') |
||
| 191 | ->cannotBeEmpty() |
||
| 192 | ->end() |
||
| 193 | ->scalarNode('formatter') |
||
| 194 | ->info('This must be a service id to a service implementing Http\Message\Formatter') |
||
| 195 | ->defaultNull() |
||
| 196 | ->end() |
||
| 197 | ->end() |
||
| 198 | ->end() // End logger plugin |
||
| 199 | |||
| 200 | ->arrayNode('redirect') |
||
| 201 | ->canBeDisabled() |
||
| 202 | ->addDefaultsIfNotSet() |
||
| 203 | ->children() |
||
| 204 | ->scalarNode('preserve_header')->defaultTrue()->end() |
||
| 205 | ->scalarNode('use_default_for_multiple')->defaultTrue()->end() |
||
| 206 | ->end() |
||
| 207 | ->end() // End redirect plugin |
||
| 208 | |||
| 209 | ->arrayNode('retry') |
||
| 210 | ->canBeDisabled() |
||
| 211 | ->addDefaultsIfNotSet() |
||
| 212 | ->children() |
||
| 213 | ->scalarNode('retry')->defaultValue(1)->end() |
||
| 214 | ->end() |
||
| 215 | ->end() // End retry plugin |
||
| 216 | |||
| 217 | ->arrayNode('stopwatch') |
||
| 218 | ->canBeDisabled() |
||
| 219 | ->addDefaultsIfNotSet() |
||
| 220 | ->children() |
||
| 221 | ->scalarNode('stopwatch') |
||
| 222 | ->info('This must be a service id to a service extending Symfony\Component\Stopwatch\Stopwatch') |
||
| 223 | ->defaultValue('debug.stopwatch') |
||
| 224 | ->cannotBeEmpty() |
||
| 225 | ->end() |
||
| 226 | ->end() |
||
| 227 | ->end() // End stopwatch plugin |
||
| 228 | |||
| 229 | ->end() |
||
| 230 | ->end() |
||
| 231 | ->end(); |
||
| 232 | } |
||
| 233 | } |
||
| 234 |