| Conditions | 7 |
| Paths | 36 |
| Total Lines | 52 |
| Code Lines | 37 |
| 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 |
||
| 32 | public function __invoke(stdClass $feedRoot, string $namespaceAlias, DOMXPath $xpath): void |
||
| 33 | { |
||
| 34 | // lang (single, scalar) |
||
| 35 | $this->addArrayProperty($feedRoot, 'lang'); |
||
| 36 | $xq = $xpath->query($this->applyNsToQuery('/%s:feed[attribute::xml:lang][1]/@xml:lang', $namespaceAlias)); |
||
| 37 | |||
| 38 | $feedRoot->lang[$namespaceAlias] = ($xq->length > 0) |
||
| 39 | ? T\Node::factory((string) $xq->item(0)->nodeValue) |
||
| 40 | : null; |
||
| 41 | |||
| 42 | // single, scalar types |
||
| 43 | foreach ([ |
||
| 44 | 'icon', |
||
| 45 | 'id', |
||
| 46 | 'logo', |
||
| 47 | 'published', |
||
| 48 | 'rights', |
||
| 49 | 'subtitle', |
||
| 50 | 'summary', |
||
| 51 | 'title', |
||
| 52 | 'updated', |
||
| 53 | ] as $nodeName) { |
||
| 54 | $this->addArrayProperty($feedRoot, $nodeName); |
||
| 55 | $feedRoot->{$nodeName}[$namespaceAlias] = $this->getSingle($nodeName, $namespaceAlias, $xpath); |
||
| 56 | } |
||
| 57 | |||
| 58 | // single, complex types |
||
| 59 | foreach ([ |
||
| 60 | 'author' => T\Person::class, |
||
| 61 | 'generator' => T\Generator::class, |
||
| 62 | ] as $name => $class) { |
||
| 63 | $this->addArrayProperty($feedRoot, $name); |
||
| 64 | $xq = $xpath->query($this->generateQuery($namespaceAlias, true, 'feed', $name)); |
||
| 65 | |||
| 66 | $feedRoot->{$name}[$namespaceAlias] = ($xq->length > 0) |
||
| 67 | ? new $class($xq->item(0), $this->getLogger()) |
||
| 68 | : null; |
||
| 69 | } |
||
| 70 | |||
| 71 | // multiple, complex types |
||
| 72 | foreach ([ |
||
| 73 | 'category' => T\Category::class, |
||
| 74 | 'contributor' => T\Person::class, |
||
| 75 | 'link' => T\Link::class, |
||
| 76 | ] as $name => $class) { |
||
| 77 | $this->addArrayProperty($feedRoot, $name); |
||
| 78 | $xq = $xpath->query($this->generateQuery($namespaceAlias, true, 'feed', $name)); |
||
| 79 | |||
| 80 | $feedRoot->{$name}[$namespaceAlias] = []; |
||
| 81 | |||
| 82 | foreach ($xq as $result) { |
||
| 83 | $feedRoot->{$name}[$namespaceAlias][] = new $class($result, $this->getLogger()); |
||
| 84 | } |
||
| 108 |
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