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\XML\Constants as C; |
||
|
0 ignored issues
–
show
|
|||
| 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\SchemaViolationException; |
||
| 14 | use SimpleSAML\XMLSchema\Type\IDValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\IDValue 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...
|
|||
| 15 | use SimpleSAML\XMLSecurity\Assert\Assert; |
||
| 16 | |||
| 17 | use function strval; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Class representing a ds:SignatureProperties element. |
||
| 21 | * |
||
| 22 | * @package simplesamlphp/xml-security |
||
| 23 | */ |
||
| 24 | final class SignatureProperties 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...
|
|||
| 25 | { |
||
| 26 | use SchemaValidatableElementTrait; |
||
| 27 | |||
| 28 | |||
| 29 | /** |
||
| 30 | * Initialize a ds:SignatureProperties |
||
| 31 | * |
||
| 32 | * @param \SimpleSAML\XMLSecurity\XML\ds\SignatureProperty[] $signatureProperty |
||
| 33 | * @param \SimpleSAML\XMLSchema\Type\IDValue|null $Id |
||
| 34 | */ |
||
| 35 | public function __construct( |
||
| 36 | protected array $signatureProperty, |
||
| 37 | protected ?IDValue $Id = null, |
||
| 38 | ) { |
||
| 39 | Assert::maxCount($signatureProperty, C::UNBOUNDED_LIMIT); |
||
| 40 | Assert::allIsInstanceOf($signatureProperty, SignatureProperty::class, SchemaViolationException::class); |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSecurity\XML\ds\SignatureProperty 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...
|
|||
| 41 | } |
||
| 42 | |||
| 43 | |||
| 44 | /** |
||
| 45 | * @return \SimpleSAML\XMLSecurity\XML\ds\SignatureProperty[] |
||
| 46 | */ |
||
| 47 | public function getSignatureProperty(): array |
||
| 48 | { |
||
| 49 | return $this->signatureProperty; |
||
| 50 | } |
||
| 51 | |||
| 52 | |||
| 53 | /** |
||
| 54 | * @return \SimpleSAML\XMLSchema\Type\IDValue|null |
||
| 55 | */ |
||
| 56 | public function getId(): ?IDValue |
||
| 57 | { |
||
| 58 | return $this->Id; |
||
| 59 | } |
||
| 60 | |||
| 61 | |||
| 62 | /** |
||
| 63 | * Convert XML into a SignatureProperties element |
||
| 64 | * |
||
| 65 | * @param \DOMElement $xml The XML element we should load |
||
| 66 | * |
||
| 67 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 68 | * If the qualified name of the supplied element is wrong |
||
| 69 | */ |
||
| 70 | public static function fromXML(DOMElement $xml): static |
||
| 71 | { |
||
| 72 | Assert::same($xml->localName, 'SignatureProperties', InvalidDOMElementException::class); |
||
| 73 | Assert::same($xml->namespaceURI, SignatureProperties::NS, InvalidDOMElementException::class); |
||
| 74 | |||
| 75 | $signatureProperty = SignatureProperty::getChildrenOfClass($xml); |
||
| 76 | Assert::minCount( |
||
| 77 | $signatureProperty, |
||
| 78 | 1, |
||
| 79 | 'A <ds:SignatureProperties> must contain at least one <ds:SignatureProperty>.', |
||
| 80 | MissingElementException::class, |
||
| 81 | ); |
||
| 82 | |||
| 83 | return new static( |
||
| 84 | $signatureProperty, |
||
| 85 | self::getOptionalAttribute($xml, 'Id', IDValue::class, null), |
||
| 86 | ); |
||
| 87 | } |
||
| 88 | |||
| 89 | |||
| 90 | /** |
||
| 91 | * Convert this SignatureProperties element to XML. |
||
| 92 | * |
||
| 93 | * @param \DOMElement|null $parent The element we should append this SignatureProperties element to. |
||
| 94 | */ |
||
| 95 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 96 | { |
||
| 97 | $e = $this->instantiateParentElement($parent); |
||
| 98 | |||
| 99 | if ($this->getId() !== null) { |
||
| 100 | $e->setAttribute('Id', strval($this->getId())); |
||
| 101 | } |
||
| 102 | |||
| 103 | foreach ($this->getSignatureProperty() as $signatureProperty) { |
||
| 104 | $signatureProperty->toXML($e); |
||
| 105 | } |
||
| 106 | |||
| 107 | return $e; |
||
| 108 | } |
||
| 109 | } |
||
| 110 |
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