|
8 | 8 | use SimpleSAML\Assert\Assert; |
9 | 9 | use SimpleSAML\XML\Exception\InvalidDOMElementException; |
10 | 10 | use SimpleSAML\XML\Exception\SchemaViolationException; |
11 | | -use SimpleSAML\XML\StringElementTrait; |
| 11 | +use SimpleSAML\XML\IntegerElementTrait; |
12 | 12 |
|
13 | 13 | /** |
14 | 14 | * Class representing a ds:X509SerialNumber element. |
|
17 | 17 | */ |
18 | 18 | final class X509SerialNumber extends AbstractDsElement |
19 | 19 | { |
20 | | - use StringElementTrait; |
| 20 | + use IntegerElementTrait; |
21 | 21 |
|
22 | 22 |
|
23 | 23 | /** |
24 | | - * @param string $content |
| 24 | + * @param int $content |
25 | 25 | */ |
26 | | - public function __construct(string $content) |
| 26 | + public function __construct(int $content) |
27 | 27 | { |
28 | 28 | $this->setContent($content); |
29 | 29 | } |
30 | | - |
31 | | - |
32 | | - /** |
33 | | - * Validate the content of the element. |
34 | | - * |
35 | | - * @param string $content The value to go in the XML textContent |
36 | | - * @throws \Exception on failure |
37 | | - * @return void |
38 | | - */ |
39 | | - protected function validateContent(/** @scrutinizer ignore-unused */ string $content): void |
40 | | - { |
41 | | - Assert::numeric($content, SchemaViolationException::class); |
42 | | - } |
43 | | - |
44 | | - |
45 | | - /** |
46 | | - * Convert XML into a X509SerialNumber |
47 | | - * |
48 | | - * @param \DOMElement $xml The XML element we should load |
49 | | - * @return static |
50 | | - * |
51 | | - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
52 | | - * If the qualified name of the supplied element is wrong |
53 | | - */ |
54 | | - public static function fromXML(DOMElement $xml): static |
55 | | - { |
56 | | - Assert::same($xml->localName, 'X509SerialNumber', InvalidDOMElementException::class); |
57 | | - Assert::same($xml->namespaceURI, X509SerialNumber::NS, InvalidDOMElementException::class); |
58 | | - |
59 | | - return new static($xml->textContent); |
60 | | - } |
61 | | - |
62 | | - |
63 | | - /** |
64 | | - * Convert this X509SerialNumber element to XML. |
65 | | - * |
66 | | - * @param \DOMElement|null $parent The element we should append this X509SerialNumber element to. |
67 | | - * @return \DOMElement |
68 | | - */ |
69 | | - public function toXML(DOMElement $parent = null): DOMElement |
70 | | - { |
71 | | - $e = $this->instantiateParentElement($parent); |
72 | | - $e->textContent = $this->getContent(); |
73 | | - |
74 | | - return $e; |
75 | | - } |
76 | 30 | } |
0 commit comments