| Conditions | 5 |
| Paths | 2 |
| Total Lines | 56 |
| Code Lines | 39 |
| 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 |
||
| 126 | public static function fromXML(DOMElement $xml): static |
||
| 127 | { |
||
| 128 | Assert::same($xml->localName, 'AuthnAuthorityDescriptor', InvalidDOMElementException::class); |
||
| 129 | Assert::same($xml->namespaceURI, AuthnAuthorityDescriptor::NS, InvalidDOMElementException::class); |
||
| 130 | |||
| 131 | $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); |
||
| 132 | |||
| 133 | $authnQueryServices = AuthnQueryService::getChildrenOfClass($xml); |
||
| 134 | $assertionIDRequestServices = AssertionIDRequestService::getChildrenOfClass($xml); |
||
| 135 | $nameIDFormats = NameIDFormat::getChildrenOfClass($xml); |
||
| 136 | |||
| 137 | $validUntil = self::getAttribute($xml, 'validUntil', null); |
||
| 138 | |||
| 139 | $orgs = Organization::getChildrenOfClass($xml); |
||
| 140 | Assert::maxCount( |
||
| 141 | $orgs, |
||
| 142 | 1, |
||
| 143 | 'More than one Organization found in this descriptor', |
||
| 144 | TooManyElementsException::class, |
||
| 145 | ); |
||
| 146 | |||
| 147 | $extensions = Extensions::getChildrenOfClass($xml); |
||
| 148 | Assert::maxCount( |
||
| 149 | $extensions, |
||
| 150 | 1, |
||
| 151 | 'Only one md:Extensions element is allowed.', |
||
| 152 | TooManyElementsException::class, |
||
| 153 | ); |
||
| 154 | |||
| 155 | $signature = Signature::getChildrenOfClass($xml); |
||
| 156 | Assert::maxCount( |
||
| 157 | $signature, |
||
| 158 | 1, |
||
| 159 | 'Only one ds:Signature element is allowed.', |
||
| 160 | TooManyElementsException::class, |
||
| 161 | ); |
||
| 162 | |||
| 163 | $authority = new static( |
||
| 164 | $authnQueryServices, |
||
| 165 | preg_split('/[\s]+/', trim($protocols)), |
||
| 166 | $assertionIDRequestServices, |
||
| 167 | $nameIDFormats, |
||
| 168 | self::getAttribute($xml, 'ID', null), |
||
| 169 | $validUntil !== null ? XMLUtils::xsDateTimeToTimestamp($validUntil) : null, |
||
| 170 | self::getAttribute($xml, 'cacheDuration', null), |
||
| 171 | !empty($extensions) ? $extensions[0] : null, |
||
| 172 | self::getAttribute($xml, 'errorURL', null), |
||
| 173 | !empty($orgs) ? $orgs[0] : null, |
||
| 174 | KeyDescriptor::getChildrenOfClass($xml), |
||
| 175 | ContactPerson::getChildrenOfClass($xml), |
||
|
|
|||
| 176 | ); |
||
| 177 | if (!empty($signature)) { |
||
| 178 | $authority->setSignature($signature[0]); |
||
| 179 | $authority->setXML($xml); |
||
| 180 | } |
||
| 181 | return $authority; |
||
| 182 | } |
||
| 212 |
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