simplesamlphp /
xml-security
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace SimpleSAML\XMLSecurity\XML\ds; |
||
| 6 | |||
| 7 | use DOMElement; |
||
| 8 | use SimpleSAML\Assert\Assert; |
||
| 9 | use SimpleSAML\XML\SchemaValidatableElementInterface; |
||
| 10 | use SimpleSAML\XML\SchemaValidatableElementTrait; |
||
| 11 | use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
||
| 12 | use SimpleSAML\XMLSchema\Exception\TooManyElementsException; |
||
| 13 | use SimpleSAML\XMLSchema\Type\AnyURIValue; |
||
|
0 ignored issues
–
show
|
|||
| 14 | |||
| 15 | use function strval; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Class representing a ds:RetrievalMethod element. |
||
| 19 | * |
||
| 20 | * @package simplesamlphp/xml-security |
||
| 21 | */ |
||
| 22 | final class RetrievalMethod extends AbstractDsElement implements SchemaValidatableElementInterface |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 23 | { |
||
| 24 | use SchemaValidatableElementTrait; |
||
| 25 | |||
| 26 | |||
| 27 | /** |
||
| 28 | * Initialize a ds:RetrievalMethod |
||
| 29 | * |
||
| 30 | * @param \SimpleSAML\XMLSecurity\XML\ds\Transforms|null $transforms |
||
| 31 | * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $URI |
||
| 32 | * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Type |
||
| 33 | */ |
||
| 34 | final public function __construct( |
||
| 35 | protected ?Transforms $transforms, |
||
| 36 | protected AnyURIValue $URI, |
||
| 37 | protected ?AnyURIValue $Type = null, |
||
| 38 | ) { |
||
| 39 | } |
||
| 40 | |||
| 41 | |||
| 42 | /** |
||
| 43 | * @return \SimpleSAML\XMLSecurity\XML\ds\Transforms|null |
||
| 44 | */ |
||
| 45 | public function getTransforms(): ?Transforms |
||
| 46 | { |
||
| 47 | return $this->transforms; |
||
| 48 | } |
||
| 49 | |||
| 50 | |||
| 51 | /** |
||
| 52 | * @return \SimpleSAML\XMLSchema\Type\AnyURIValue |
||
| 53 | */ |
||
| 54 | public function getURI(): AnyURIValue |
||
| 55 | { |
||
| 56 | return $this->URI; |
||
| 57 | } |
||
| 58 | |||
| 59 | |||
| 60 | /** |
||
| 61 | * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null |
||
| 62 | */ |
||
| 63 | public function getType(): ?AnyURIValue |
||
| 64 | { |
||
| 65 | return $this->Type; |
||
| 66 | } |
||
| 67 | |||
| 68 | |||
| 69 | /** |
||
| 70 | * Convert XML into a RetrievalMethod element |
||
| 71 | * |
||
| 72 | * @param \DOMElement $xml The XML element we should load |
||
| 73 | * |
||
| 74 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 75 | * If the qualified name of the supplied element is wrong |
||
| 76 | */ |
||
| 77 | public static function fromXML(DOMElement $xml): static |
||
| 78 | { |
||
| 79 | Assert::same($xml->localName, 'RetrievalMethod', InvalidDOMElementException::class); |
||
| 80 | Assert::same($xml->namespaceURI, RetrievalMethod::NS, InvalidDOMElementException::class); |
||
| 81 | |||
| 82 | $URI = self::getAttribute($xml, 'URI', AnyURIValue::class); |
||
| 83 | $Type = self::getOptionalAttribute($xml, 'Type', AnyURIValue::class, null); |
||
| 84 | |||
| 85 | $transforms = Transforms::getChildrenOfClass($xml); |
||
| 86 | Assert::maxCount( |
||
| 87 | $transforms, |
||
| 88 | 1, |
||
| 89 | 'A <ds:RetrievalMethod> may contain a maximum of one <ds:Transforms>.', |
||
| 90 | TooManyElementsException::class, |
||
| 91 | ); |
||
| 92 | |||
| 93 | return new static( |
||
| 94 | array_pop($transforms), |
||
| 95 | $URI, |
||
| 96 | $Type, |
||
| 97 | ); |
||
| 98 | } |
||
| 99 | |||
| 100 | |||
| 101 | /** |
||
| 102 | * Convert this RetrievalMethod element to XML. |
||
| 103 | * |
||
| 104 | * @param \DOMElement|null $parent The element we should append this RetrievalMethod element to. |
||
| 105 | */ |
||
| 106 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 107 | { |
||
| 108 | $e = $this->instantiateParentElement($parent); |
||
| 109 | $e->setAttribute('URI', strval($this->getURI())); |
||
| 110 | |||
| 111 | if ($this->getType() !== null) { |
||
| 112 | $e->setAttribute('Type', strval($this->getType())); |
||
| 113 | } |
||
| 114 | |||
| 115 | $this->getTransforms()?->toXML($e); |
||
| 116 | |||
| 117 | return $e; |
||
| 118 | } |
||
| 119 | } |
||
| 120 |
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