1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\WSSecurity\XML\wsaw; |
6
|
|
|
|
7
|
|
|
use DOMElement; |
8
|
|
|
use SimpleSAML\Assert\Assert; |
9
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
10
|
|
|
use SimpleSAML\XML\Exception\SchemaViolationException; |
11
|
|
|
use SimpleSAML\XML\ExtendableAttributesTrait; |
12
|
|
|
use SimpleSAML\XML\QNameElementTrait; |
13
|
|
|
use SimpleSAML\XML\XsNamespace as NS; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Abstract class defining the AttributedQName type |
17
|
|
|
* |
18
|
|
|
* @package simplesamlphp/ws-security |
19
|
|
|
*/ |
20
|
|
|
abstract class AbstractAttributedQNameType extends AbstractWsawElement |
21
|
|
|
{ |
22
|
|
|
use ExtendableAttributesTrait; |
23
|
|
|
use QNameElementTrait; |
24
|
|
|
|
25
|
|
|
/** The namespace-attribute for the xs:anyAttribute element */ |
26
|
|
|
public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* AbstractAttributedQNameType constructor |
31
|
|
|
* |
32
|
|
|
* @param string $value |
33
|
|
|
* @param \SimpleSAML\XML\Attribute[] $namespacedAttributes |
34
|
|
|
*/ |
35
|
|
|
public function __construct( |
36
|
|
|
string $value, |
37
|
|
|
array $namespacedAttributes = [], |
38
|
|
|
) { |
39
|
|
|
$this->setContent($value); |
40
|
|
|
$this->setAttributesNS($namespacedAttributes); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Convert this AttributedQNameType to XML. |
46
|
|
|
* |
47
|
|
|
* @param \DOMElement|null $parent The element we should append this class to. |
48
|
|
|
* @return \DOMElement The XML element after adding the data corresponding to this AttributedQNameType. |
49
|
|
|
*/ |
50
|
|
|
public function toXML(DOMElement $parent = null): DOMElement |
51
|
|
|
{ |
52
|
|
|
$e = $this->instantiateParentElement($parent); |
53
|
|
|
$e->textContent = $this->getContent(); |
54
|
|
|
|
55
|
|
|
foreach ($this->getAttributesNS() as $attr) { |
56
|
|
|
$attr->toXML($e); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
return $e; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|