| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 55 | 
| 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  | 
            ||
| 115 | public static function fromXML(DOMElement $xml): static  | 
            ||
| 116 |     { | 
            ||
| 117 | Assert::same($xml->localName, 'RoleDescriptor', InvalidDOMElementException::class);  | 
            ||
| 118 | Assert::same($xml->namespaceURI, C::NS_MD, InvalidDOMElementException::class);  | 
            ||
| 119 | Assert::true(  | 
            ||
| 120 | $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'),  | 
            ||
| 121 | 'Missing required xsi:type in <md:RoleDescriptor> element.',  | 
            ||
| 122 | SchemaViolationException::class,  | 
            ||
| 123 | );  | 
            ||
| 124 | |||
| 125 | $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml);  | 
            ||
| 126 | |||
| 127 | // now check if we have a handler registered for it  | 
            ||
| 128 | $handler = Utils::getContainer()->getExtensionHandler($type);  | 
            ||
| 129 |         if ($handler === null) { | 
            ||
| 130 | // we don't have a handler, proceed with unknown RoleDescriptor  | 
            ||
| 131 | $orgs = Organization::getChildrenOfClass($xml);  | 
            ||
| 132 | Assert::maxCount(  | 
            ||
| 133 | $orgs,  | 
            ||
| 134 | 1,  | 
            ||
| 135 | 'More than one Organization found in this descriptor',  | 
            ||
| 136 | TooManyElementsException::class,  | 
            ||
| 137 | );  | 
            ||
| 138 | |||
| 139 | $extensions = Extensions::getChildrenOfClass($xml);  | 
            ||
| 140 | Assert::maxCount(  | 
            ||
| 141 | $extensions,  | 
            ||
| 142 | 1,  | 
            ||
| 143 | 'Only one md:Extensions element is allowed.',  | 
            ||
| 144 | TooManyElementsException::class,  | 
            ||
| 145 | );  | 
            ||
| 146 | |||
| 147 | return new UnknownRoleDescriptor(  | 
            ||
| 148 | new Chunk($xml),  | 
            ||
| 149 | $type,  | 
            ||
| 150 | self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class),  | 
            ||
| 151 | self::getOptionalAttribute($xml, 'ID', IDValue::class, null),  | 
            ||
| 152 | self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null),  | 
            ||
| 153 | self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null),  | 
            ||
| 154 | array_pop($extensions),  | 
            ||
| 155 | self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null),  | 
            ||
| 156 | KeyDescriptor::getChildrenOfClass($xml),  | 
            ||
| 157 | array_pop($orgs),  | 
            ||
| 158 | ContactPerson::getChildrenOfClass($xml),  | 
            ||
| 159 | self::getAttributesNSFromXML($xml),  | 
            ||
| 160 | );  | 
            ||
| 161 | }  | 
            ||
| 162 | |||
| 163 | Assert::subclassOf(  | 
            ||
| 164 | $handler,  | 
            ||
| 165 | AbstractRoleDescriptor::class,  | 
            ||
| 166 | 'Elements implementing RoleDescriptor must extend \SimpleSAML\SAML2\XML\saml\AbstractRoleDescriptor.',  | 
            ||
| 167 | );  | 
            ||
| 168 | |||
| 169 | return $handler::fromXML($xml);  | 
            ||
| 170 | }  | 
            ||
| 172 | 
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