simplesamlphp /
xml-cas
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace SimpleSAML\CAS\XML; |
||
| 6 | |||
| 7 | use DOMElement; |
||
| 8 | use SimpleSAML\CAS\Assert\Assert; |
||
| 9 | use SimpleSAML\XML\SchemaValidatableElementInterface; |
||
| 10 | use SimpleSAML\XML\SchemaValidatableElementTrait; |
||
| 11 | use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
||
| 12 | use SimpleSAML\XMLSchema\Exception\MissingElementException; |
||
| 13 | use SimpleSAML\XMLSchema\Exception\TooManyElementsException; |
||
| 14 | |||
| 15 | use function array_merge; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Class for CAS serviceResponse |
||
| 19 | * |
||
| 20 | * @package simplesamlphp/xml-cas |
||
| 21 | */ |
||
| 22 | final class ServiceResponse extends AbstractServiceResponse implements SchemaValidatableElementInterface |
||
|
0 ignored issues
–
show
|
|||
| 23 | { |
||
| 24 | use SchemaValidatableElementTrait; |
||
| 25 | |||
| 26 | |||
| 27 | /** |
||
| 28 | * Convert XML into a cas:serviceResponse-element |
||
| 29 | * |
||
| 30 | * @param \DOMElement $xml The XML element we should load |
||
| 31 | * @return static |
||
| 32 | * |
||
| 33 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 34 | * if the qualified name of the supplied element is wrong |
||
| 35 | * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException |
||
| 36 | * if the supplied element is missing one of the mandatory attributes |
||
| 37 | */ |
||
| 38 | public static function fromXML(DOMElement $xml): static |
||
| 39 | { |
||
| 40 | Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); |
||
| 41 | Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class); |
||
| 42 | |||
| 43 | $authenticationSuccess = AuthenticationSuccess::getChildrenOfClass($xml); |
||
| 44 | $authenticationFailure = AuthenticationFailure::getChildrenOfClass($xml); |
||
| 45 | $proxySuccess = ProxySuccess::getChildrenOfClass($xml); |
||
| 46 | $proxyFailure = ProxyFailure::getChildrenOfClass($xml); |
||
| 47 | |||
| 48 | $response = array_merge($authenticationSuccess, $authenticationFailure, $proxySuccess, $proxyFailure); |
||
| 49 | Assert::notEmpty( |
||
| 50 | $response, |
||
| 51 | 'The <cas:serviceResponse> must contain exactly one of <cas:authenticationSuccess>,' |
||
| 52 | . ' <cas:authenticationFailure>, <cas:proxySuccess> or <cas:proxyFailure>.', |
||
| 53 | MissingElementException::class, |
||
| 54 | ); |
||
| 55 | Assert::count( |
||
| 56 | $response, |
||
| 57 | 1, |
||
| 58 | 'The <cas:serviceResponse> must contain exactly one of <cas:authenticationSuccess>,' |
||
| 59 | . ' <cas:authenticationFailure>, <cas:proxySuccess> or <cas:proxyFailure>.', |
||
| 60 | TooManyElementsException::class, |
||
| 61 | ); |
||
| 62 | |||
| 63 | return new static($response[0]); |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
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