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\SchemaValidatableElementInterface; |
||
| 9 | use SimpleSAML\XML\SchemaValidatableElementTrait; |
||
| 10 | use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
||
| 11 | use SimpleSAML\XMLSchema\Type\Base64BinaryValue; |
||
|
0 ignored issues
–
show
|
|||
| 12 | 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...
|
|||
| 13 | use SimpleSAML\XMLSecurity\Assert\Assert; |
||
| 14 | |||
| 15 | use function strval; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Class representing a ds:SignatureValue element. |
||
| 19 | * |
||
| 20 | * @package simplesaml/xml-security |
||
| 21 | */ |
||
| 22 | final class SignatureValue 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 | * @param \SimpleSAML\XMLSchema\Type\Base64BinaryValue $value |
||
| 29 | * @param \SimpleSAML\XMLSchema\Type\IDValue|null $Id |
||
| 30 | */ |
||
| 31 | public function __construct( |
||
| 32 | protected Base64BinaryValue $value, |
||
| 33 | protected ?IDValue $Id = null, |
||
| 34 | ) { |
||
| 35 | } |
||
| 36 | |||
| 37 | |||
| 38 | /** |
||
| 39 | * Get the Id used for this signature value. |
||
| 40 | * |
||
| 41 | * @return \SimpleSAML\XMLSchema\Type\IDValue|null |
||
| 42 | */ |
||
| 43 | public function getId(): ?IDValue |
||
| 44 | { |
||
| 45 | return $this->Id; |
||
| 46 | } |
||
| 47 | |||
| 48 | |||
| 49 | /** |
||
| 50 | * Get the content for this signature value. |
||
| 51 | * |
||
| 52 | * @return \SimpleSAML\XMLSchema\Type\Base64BinaryValue |
||
| 53 | */ |
||
| 54 | public function getValue(): Base64BinaryValue |
||
| 55 | { |
||
| 56 | return $this->value; |
||
| 57 | } |
||
| 58 | |||
| 59 | |||
| 60 | /** |
||
| 61 | * Convert XML into a SignatureValue element |
||
| 62 | * |
||
| 63 | * @param \DOMElement $xml |
||
| 64 | * |
||
| 65 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 66 | * If the qualified name of the supplied element is wrong |
||
| 67 | */ |
||
| 68 | public static function fromXML(DOMElement $xml): static |
||
| 69 | { |
||
| 70 | Assert::same($xml->localName, 'SignatureValue', InvalidDOMElementException::class); |
||
| 71 | Assert::same($xml->namespaceURI, SignatureValue::NS, InvalidDOMElementException::class); |
||
| 72 | |||
| 73 | $Id = self::getOptionalAttribute($xml, 'Id', IDValue::class, null); |
||
| 74 | |||
| 75 | return new static(Base64BinaryValue::fromString($xml->textContent), $Id); |
||
| 76 | } |
||
| 77 | |||
| 78 | |||
| 79 | /** |
||
| 80 | * Convert this SignatureValue element to XML. |
||
| 81 | * |
||
| 82 | * @param \DOMElement|null $parent The element we should append this SignatureValue element to. |
||
| 83 | */ |
||
| 84 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 85 | { |
||
| 86 | $e = $this->instantiateParentElement($parent); |
||
| 87 | $e->textContent = strval($this->getValue()); |
||
| 88 | |||
| 89 | if ($this->getId() !== null) { |
||
| 90 | $e->setAttribute('Id', strval($this->getId())); |
||
| 91 | } |
||
| 92 | |||
| 93 | return $e; |
||
| 94 | } |
||
| 95 | } |
||
| 96 |
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