Conditions | 10 |
Paths | 9 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
53 | private static function addChildElement($parentNode, $key, $value) { |
||
54 | if (\is_bool($value)) { |
||
55 | $value = $value ? 'true' : 'false'; |
||
56 | $parentNode->addAttribute($key, $value); |
||
57 | } |
||
58 | elseif (\is_string($value) || \is_numeric($value)) { |
||
59 | $parentNode->addAttribute($key, $value); |
||
60 | } |
||
61 | elseif (\is_array($value)) { |
||
62 | if (self::arrayIsIndexed($value)) { |
||
63 | foreach ($value as $child) { |
||
64 | self::addChildElement($parentNode, $key, $child); |
||
65 | } |
||
66 | } |
||
67 | else { |
||
68 | // associative array |
||
69 | $element = $parentNode->addChild($key); |
||
70 | foreach ($value as $childKey => $childValue) { |
||
71 | self::addChildElement($element, $childKey, $childValue); |
||
72 | } |
||
73 | } |
||
74 | } |
||
75 | elseif ($value === null) { |
||
76 | // skip |
||
77 | } |
||
78 | else { |
||
79 | throw new \Exception("Unexpected value type for key $key"); |
||
80 | } |
||
91 | } |
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