| Conditions | 2 |
| Paths | 2 |
| Total Lines | 53 |
| Code Lines | 35 |
| 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 |
||
| 86 | public static function fromXML(DOMElement $xml): static |
||
| 87 | { |
||
| 88 | Assert::same($xml->localName, 'AssertionIDRequest', InvalidDOMElementException::class); |
||
| 89 | Assert::same($xml->namespaceURI, AssertionIDRequest::NS, InvalidDOMElementException::class); |
||
| 90 | |||
| 91 | $assertionIDRef = AssertionIDRef::getChildrenOfClass($xml); |
||
| 92 | Assert::minCount( |
||
| 93 | $assertionIDRef, |
||
| 94 | 1, |
||
| 95 | 'At least one <samlp:AssertionIDRef> element is required.', |
||
| 96 | TooManyElementsException::class, |
||
| 97 | ); |
||
| 98 | |||
| 99 | $issuer = Issuer::getChildrenOfClass($xml); |
||
| 100 | Assert::maxCount($issuer, 1, 'Only one <saml:Issuer> element is allowed.', TooManyElementsException::class); |
||
| 101 | |||
| 102 | $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); |
||
| 103 | Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); |
||
| 104 | Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); |
||
| 105 | |||
| 106 | $extensions = Extensions::getChildrenOfClass($xml); |
||
| 107 | Assert::maxCount( |
||
| 108 | $extensions, |
||
| 109 | 1, |
||
| 110 | 'Only one <samlp:Extensions> element is allowed.', |
||
| 111 | TooManyElementsException::class, |
||
| 112 | ); |
||
| 113 | |||
| 114 | $signature = Signature::getChildrenOfClass($xml); |
||
| 115 | Assert::maxCount( |
||
| 116 | $signature, |
||
| 117 | 1, |
||
| 118 | 'Only one <ds:Signature> element is allowed.', |
||
| 119 | TooManyElementsException::class, |
||
| 120 | ); |
||
| 121 | |||
| 122 | $request = new static( |
||
| 123 | self::getAttribute($xml, 'ID', IDValue::class), |
||
| 124 | $assertionIDRef, |
||
| 125 | array_pop($issuer), |
||
| 126 | self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), |
||
| 127 | self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), |
||
| 128 | self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), |
||
| 129 | array_pop($extensions), |
||
| 130 | ); |
||
| 131 | |||
| 132 | if (!empty($signature)) { |
||
| 133 | $request->setSignature($signature[0]); |
||
| 134 | $request->messageContainedSignatureUponConstruction = true; |
||
| 135 | $request->setXML($xml); |
||
| 136 | } |
||
| 137 | |||
| 138 | return $request; |
||
| 139 | } |
||
| 156 |
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