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 |
||
19 | public function getConfigTreeBuilder() |
||
20 | { |
||
21 | $treeBuilder = new TreeBuilder(self::ROOT_NAME); |
||
22 | $rootNode = $this->getRootNode($treeBuilder); |
||
23 | $excludedPrefixes = ['/_wdt', '/_profiler', '/_error']; |
||
24 | |||
25 | $rootNode |
||
26 | ->children() |
||
27 | ->scalarNode('project_key') |
||
28 | ->isRequired() |
||
29 | ->cannotBeEmpty() |
||
30 | ->info('Your project key that can be found at: https://redirection.io/manager/<organization>/<project>/instances') |
||
31 | ->end() |
||
32 | ->arrayNode('connections') |
||
33 | ->normalizeKeys(false) |
||
34 | ->useAttributeAsKey('name') |
||
35 | ->addDefaultChildrenIfNoneSet('default') |
||
36 | ->prototype('scalar') |
||
37 | ->info('a TCP or unix socket') |
||
38 | ->example('tcp://127.0.0.1:20301 or unix:///var/run/redirectionio_agent.sock') |
||
39 | ->isRequired() |
||
40 | ->cannotBeEmpty() |
||
41 | ->defaultValue('tcp://127.0.0.1:20301') |
||
42 | ->end() |
||
43 | ->end() |
||
44 | ->booleanNode('persist') |
||
45 | ->info('Persist client connections to be reuse on other requests') |
||
46 | ->defaultTrue() |
||
47 | ->end() |
||
48 | ->booleanNode('debug') |
||
49 | ->info('Throw exception if something wrong happens') |
||
50 | ->defaultValue('%kernel.debug%') |
||
51 | ->end() |
||
52 | ->booleanNode('match_on_response') |
||
53 | ->info('Allow match on response status rules') |
||
54 | ->defaultValue(false) |
||
55 | ->end() |
||
56 | ->arrayNode('excluded_prefixes') |
||
57 | ->info('Exclude a set of prefixes from processing') |
||
58 | ->prototype('scalar')->end() |
||
59 | ->validate() |
||
60 | ->always() |
||
61 | ->then(function ($v) use ($excludedPrefixes) { return array_unique(array_merge($excludedPrefixes, $v)); }) |
||
62 | ->end() |
||
63 | ->defaultValue($excludedPrefixes) |
||
64 | ->end() |
||
65 | ->arrayNode('excluded_hosts') |
||
66 | ->info('Exclude a set of hosts from processing') |
||
67 | ->prototype('scalar')->end() |
||
68 | ->end() |
||
69 | ->end() |
||
70 | ; |
||
71 | |||
72 | return $treeBuilder; |
||
73 | } |
||
87 |
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