| Conditions | 1 |
| Paths | 1 |
| Total Lines | 87 |
| Code Lines | 75 |
| 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 |
||
| 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 | ->canBeEnabled() |
||
| 169 | ->children() |
||
| 170 | ->scalarNode('logger')->isRequired()->cannotBeEmpty()->end() |
||
| 171 | ->scalarNode('formatter')->defaultNull()->end() |
||
| 172 | ->end() |
||
| 173 | ->end() // End logger plugin |
||
| 174 | |||
| 175 | ->arrayNode('redirect') |
||
| 176 | ->canBeDisabled() |
||
| 177 | ->addDefaultsIfNotSet() |
||
| 178 | ->children() |
||
| 179 | ->scalarNode('preserve_header')->defaultTrue()->end() |
||
| 180 | ->scalarNode('use_default_for_multiple')->defaultTrue()->end() |
||
| 181 | ->end() |
||
| 182 | ->end() // End redirect plugin |
||
| 183 | |||
| 184 | ->arrayNode('retry') |
||
| 185 | ->canBeDisabled() |
||
| 186 | ->addDefaultsIfNotSet() |
||
| 187 | ->children() |
||
| 188 | ->scalarNode('retry')->defaultValue(1)->end() |
||
| 189 | ->end() |
||
| 190 | ->end() // End retry plugin |
||
| 191 | |||
| 192 | ->arrayNode('stopwatch') |
||
| 193 | ->canBeEnabled() |
||
| 194 | ->children() |
||
| 195 | ->scalarNode('stopwatch')->isRequired()->cannotBeEmpty()->end() |
||
| 196 | ->end() |
||
| 197 | ->end() // End stopwatch plugin |
||
| 198 | |||
| 199 | ->end() |
||
| 200 | ->end() |
||
| 201 | ->end(); |
||
| 202 | } |
||
| 203 | } |
||
| 204 |