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