| Conditions | 7 | 
| Paths | 8 | 
| Total Lines | 59 | 
| Code Lines | 41 | 
| 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  | 
            ||
| 102 | public static function fromXML(DOMElement $xml): static  | 
            ||
| 103 |     { | 
            ||
| 104 | Assert::same($xml->localName, 'RoleDescriptor', InvalidDOMElementException::class);  | 
            ||
| 105 | Assert::same($xml->namespaceURI, C::NS_MD, InvalidDOMElementException::class);  | 
            ||
| 106 | Assert::true(  | 
            ||
| 107 | $xml->hasAttributeNS(C::NS_XSI, 'type'),  | 
            ||
| 108 | 'Missing required xsi:type in <saml:RoleDescriptor> element.',  | 
            ||
| 109 | SchemaViolationException::class  | 
            ||
| 110 | );  | 
            ||
| 111 | |||
| 112 | $type = $xml->getAttributeNS(C::NS_XSI, 'type');  | 
            ||
| 113 | Assert::validQName($type, SchemaViolationException::class);  | 
            ||
| 114 | |||
| 115 | // first, try to resolve the type to a full namespaced version  | 
            ||
| 116 |         $qname = explode(':', $type, 2); | 
            ||
| 117 |         if (count($qname) === 2) { | 
            ||
| 118 | list($prefix, $element) = $qname;  | 
            ||
| 119 |         } else { | 
            ||
| 120 | $prefix = null;  | 
            ||
| 121 | list($element) = $qname;  | 
            ||
| 122 | }  | 
            ||
| 123 | $ns = $xml->lookupNamespaceUri($prefix);  | 
            ||
| 124 |         $type = ($ns === null ) ? $element : implode(':', [$ns, $element]); | 
            ||
| 125 | |||
| 126 | // now check if we have a handler registered for it  | 
            ||
| 127 | $handler = Utils::getContainer()->getExtensionHandler($type);  | 
            ||
| 128 |         if ($handler === null) { | 
            ||
| 129 | // we don't have a handler, proceed with unknown identifier  | 
            ||
| 130 | $protocols = self::getAttribute($xml, 'protocolSupportEnumeration');  | 
            ||
| 131 | |||
| 132 | $validUntil = self::getAttribute($xml, 'validUntil', null);  | 
            ||
| 133 | $orgs = Organization::getChildrenOfClass($xml);  | 
            ||
| 134 | Assert::maxCount($orgs, 1, 'More than one Organization found in this descriptor', TooManyElementsException::class);  | 
            ||
| 135 | |||
| 136 | $extensions = Extensions::getChildrenOfClass($xml);  | 
            ||
| 137 | Assert::maxCount($extensions, 1, 'Only one md:Extensions element is allowed.', TooManyElementsException::class);  | 
            ||
| 138 | |||
| 139 | return new UnknownRoleDescriptor(  | 
            ||
| 140 | new Chunk($xml),  | 
            ||
| 141 | $type,  | 
            ||
| 142 |                 preg_split('/[\s]+/', trim($protocols)), | 
            ||
| 143 | self::getAttribute($xml, 'ID', null),  | 
            ||
| 144 | $validUntil !== null ? XMLUtils::xsDateTimeToTimestamp($validUntil) : null,  | 
            ||
| 145 | self::getAttribute($xml, 'cacheDuration', null),  | 
            ||
| 146 | !empty($extensions) ? $extensions[0] : null,  | 
            ||
| 147 | self::getAttribute($xml, 'errorURL', null),  | 
            ||
| 148 | KeyDescriptor::getChildrenOfClass($xml),  | 
            ||
| 149 | !empty($orgs) ? $orgs[0] : null,  | 
            ||
| 150 | ContactPerson::getChildrenOfClass($xml),  | 
            ||
| 151 | );  | 
            ||
| 152 | }  | 
            ||
| 153 | |||
| 154 | Assert::subclassOf(  | 
            ||
| 155 | $handler,  | 
            ||
| 156 | AbstractRoleDescriptor::class,  | 
            ||
| 157 | 'Elements implementing RoleDescriptor must extend \SimpleSAML\SAML2\XML\saml\AbstractRoleDescriptor.',  | 
            ||
| 158 | );  | 
            ||
| 159 | |||
| 160 | return $handler::fromXML($xml);  | 
            ||
| 161 | }  | 
            ||
| 181 | 
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