Conditions | 11 |
Paths | 7 |
Total Lines | 43 |
Code Lines | 28 |
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 |
||
87 | public static function fromXML(DOMElement $xml): static |
||
88 | { |
||
89 | Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); |
||
90 | Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); |
||
91 | |||
92 | if ($xml->childElementCount > 0) { |
||
93 | $node = $xml->firstElementChild; |
||
94 | |||
95 | if (str_contains($node->tagName, ':')) { |
||
96 | list($prefix, $eltName) = explode(':', $node->tagName); |
||
97 | $className = sprintf('\SimpleSAML\SAML11\XML\%s\%s', $prefix, $eltName); |
||
98 | |||
99 | if (class_exists($className)) { |
||
100 | $value = $className::fromXML($node); |
||
101 | } else { |
||
102 | $value = Chunk::fromXML($node); |
||
103 | } |
||
104 | } else { |
||
105 | $value = Chunk::fromXML($node); |
||
106 | } |
||
107 | } elseif ( |
||
108 | $xml->hasAttributeNS(C::NS_XSI, "type") && |
||
109 | $xml->getAttributeNS(C::NS_XSI, "type") === "xs:integer" |
||
110 | ) { |
||
111 | // we have an integer as value |
||
112 | $value = IntegerValue::fromString($xml->textContent); |
||
113 | } elseif ( |
||
114 | $xml->hasAttributeNS(C::NS_XSI, "nil") && |
||
115 | ($xml->getAttributeNS(C::NS_XSI, "nil") === "1" || $xml->getAttributeNS(C::NS_XSI, "nil") === "true") |
||
116 | ) { |
||
117 | // we have a nill value |
||
118 | $value = null; |
||
119 | } elseif ( |
||
120 | $xml->hasAttributeNS(C::NS_XSI, "type") && |
||
121 | $xml->getAttributeNS(C::NS_XSI, "type") === "xs:dateTime" |
||
122 | ) { |
||
123 | // we have a dateTime as value |
||
124 | $value = DateTimeValue::fromString($xml->textContent); |
||
125 | } else { |
||
126 | $value = StringValue::fromString($xml->textContent); |
||
127 | } |
||
128 | |||
129 | return new static($value); |
||
130 | } |
||
180 |
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