| Conditions | 1 |
| Paths | 1 |
| Total Lines | 54 |
| Code Lines | 49 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
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 |
||
| 18 | public function getConfigTreeBuilder() |
||
| 19 | { |
||
| 20 | $treeBuilder = new TreeBuilder(self::ROOT_NAME); |
||
| 21 | $rootNode = $this->getRootNode($treeBuilder); |
||
| 22 | $excludedPrefixes = ['/_wdt', '/_profiler', '/_error']; |
||
| 23 | |||
| 24 | $rootNode |
||
| 25 | ->children() |
||
| 26 | ->scalarNode('project_key') |
||
| 27 | ->isRequired() |
||
| 28 | ->cannotBeEmpty() |
||
| 29 | ->info('Your project key that can be found at: https://redirection.io/manager/<organization>/<project>/instances') |
||
| 30 | ->end() |
||
| 31 | ->arrayNode('connections') |
||
| 32 | ->normalizeKeys(false) |
||
| 33 | ->useAttributeAsKey('name') |
||
| 34 | ->addDefaultChildrenIfNoneSet('default') |
||
| 35 | ->prototype('scalar') |
||
| 36 | ->info('a TCP or unix socket') |
||
| 37 | ->example('tcp://127.0.0.1:20301 or unix:///var/run/redirectionio_agent.sock') |
||
| 38 | ->isRequired() |
||
| 39 | ->cannotBeEmpty() |
||
| 40 | ->defaultValue('tcp://127.0.0.1:20301') |
||
| 41 | ->end() |
||
| 42 | ->end() |
||
| 43 | ->booleanNode('persist') |
||
| 44 | ->info('Persist client connections to be reuse on other requests') |
||
| 45 | ->defaultTrue() |
||
| 46 | ->end() |
||
| 47 | ->booleanNode('debug') |
||
| 48 | ->info('Throw exception if something wrong happens') |
||
| 49 | ->defaultValue('%kernel.debug%') |
||
| 50 | ->end() |
||
| 51 | ->booleanNode('match_on_response') |
||
| 52 | ->info('Allow match on response status rules') |
||
| 53 | ->defaultValue(false) |
||
| 54 | ->end() |
||
| 55 | ->arrayNode('excluded_prefixes') |
||
| 56 | ->info('Exclude a set of prefixes from processing') |
||
| 57 | ->prototype('scalar')->end() |
||
| 58 | ->validate() |
||
| 59 | ->always() |
||
| 60 | ->then(function ($v) use ($excludedPrefixes) { return array_unique(array_merge($excludedPrefixes, $v)); }) |
||
| 61 | ->end() |
||
| 62 | ->defaultValue($excludedPrefixes) |
||
| 63 | ->end() |
||
| 64 | ->arrayNode('excluded_hosts') |
||
| 65 | ->info('Exclude a set of hosts from processing') |
||
| 66 | ->prototype('scalar')->end() |
||
| 67 | ->end() |
||
| 68 | ->end() |
||
| 69 | ; |
||
| 70 | |||
| 71 | return $treeBuilder; |
||
| 72 | } |
||
| 86 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths