|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\XMLSecurity\XML\ec; |
|
6
|
|
|
|
|
7
|
|
|
use DOMElement; |
|
8
|
|
|
use SimpleSAML\XML\SchemaValidatableElementInterface; |
|
9
|
|
|
use SimpleSAML\XML\SchemaValidatableElementTrait; |
|
10
|
|
|
use SimpleSAML\XMLSchema\Type\NMTokensValue; |
|
11
|
|
|
|
|
12
|
|
|
use function strval; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class implementing InclusiveNamespaces |
|
16
|
|
|
* |
|
17
|
|
|
* @package simplesamlphp/xml-security |
|
18
|
|
|
*/ |
|
19
|
|
|
class InclusiveNamespaces extends AbstractEcElement implements SchemaValidatableElementInterface |
|
20
|
|
|
{ |
|
21
|
|
|
use SchemaValidatableElementTrait; |
|
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Initialize the InclusiveNamespaces element. |
|
26
|
|
|
* |
|
27
|
|
|
* @param \SimpleSAML\XMLSchema\Type\NMTokensValue|null $prefixes |
|
28
|
|
|
*/ |
|
29
|
|
|
final public function __construct( |
|
30
|
|
|
protected ?NMTokensValue $prefixes, |
|
31
|
|
|
) { |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Get the prefixes specified by this element. |
|
37
|
|
|
* |
|
38
|
|
|
* @return \SimpleSAML\XMLSchema\Type\NMTokensValue|null |
|
39
|
|
|
*/ |
|
40
|
|
|
public function getPrefixes(): ?NMTokensValue |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->prefixes; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Convert XML into an InclusiveNamespaces element. |
|
48
|
|
|
* |
|
49
|
|
|
* @param \DOMElement $xml The XML element we should load. |
|
50
|
|
|
* @return static |
|
51
|
|
|
*/ |
|
52
|
|
|
public static function fromXML(DOMElement $xml): static |
|
53
|
|
|
{ |
|
54
|
|
|
return new static( |
|
55
|
|
|
self::getOptionalAttribute($xml, 'PrefixList', NMTokensValue::class, null), |
|
56
|
|
|
); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Convert this InclusiveNamespaces to XML. |
|
62
|
|
|
* |
|
63
|
|
|
* @param \DOMElement|null $parent The element we should append this InclusiveNamespaces to. |
|
64
|
|
|
* @return \DOMElement |
|
65
|
|
|
*/ |
|
66
|
|
|
public function toXML(?DOMElement $parent = null): DOMElement |
|
67
|
|
|
{ |
|
68
|
|
|
$e = $this->instantiateParentElement($parent); |
|
69
|
|
|
|
|
70
|
|
|
if ($this->getPrefixes() !== null) { |
|
71
|
|
|
$e->setAttribute('PrefixList', strval($this->getPrefixes())); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
return $e; |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|