1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SimpleSAML\SOAP\XML\env; |
4
|
|
|
|
5
|
|
|
use DOMElement; |
6
|
|
|
use SimpleSAML\Assert\Assert; |
7
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class representing a env:SupportedEnvelope element. |
11
|
|
|
* |
12
|
|
|
* @package simplesaml/xml-soap |
13
|
|
|
*/ |
14
|
|
|
final class SupportedEnvelope extends AbstractSoapElement |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* The qname attribute |
18
|
|
|
* |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
protected string $qname; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Initialize a soap:SupportedEnvelope |
25
|
|
|
* |
26
|
|
|
* @param string $qname |
27
|
|
|
*/ |
28
|
|
|
public function __construct(string $qname) |
29
|
|
|
{ |
30
|
|
|
$this->setQName($qname); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return string |
36
|
|
|
*/ |
37
|
|
|
public function getQName(): string |
38
|
|
|
{ |
39
|
|
|
return $this->qname; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string $qname |
45
|
|
|
*/ |
46
|
|
|
private function setQName(string $qname): void |
47
|
|
|
{ |
48
|
|
|
$this->qname = $qname; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Convert XML into an SupportedEnvelope element |
54
|
|
|
* |
55
|
|
|
* @param \DOMElement $xml The XML element we should load |
56
|
|
|
* @return static |
57
|
|
|
* |
58
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
59
|
|
|
* If the qualified name of the supplied element is wrong |
60
|
|
|
*/ |
61
|
|
|
public static function fromXML(DOMElement $xml): static |
62
|
|
|
{ |
63
|
|
|
Assert::same($xml->localName, 'SupportedEnvelope', InvalidDOMElementException::class); |
64
|
|
|
Assert::same($xml->namespaceURI, SupportedEnvelope::NS, InvalidDOMElementException::class); |
65
|
|
|
|
66
|
|
|
$qname = self::getAttribute($xml, 'qname'); |
67
|
|
|
|
68
|
|
|
return new static($qname); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Convert this SupportedEnvelope to XML. |
74
|
|
|
* |
75
|
|
|
* @param \DOMElement|null $parent The element we should add this SupportedEnvelope to. |
76
|
|
|
* @return \DOMElement This SupportedEnvelope-element. |
77
|
|
|
*/ |
78
|
|
|
public function toXML(DOMElement $parent = null): DOMElement |
79
|
|
|
{ |
80
|
|
|
$e = $this->instantiateParentElement($parent); |
81
|
|
|
$e->setAttribute('qname', $this->qname); |
82
|
|
|
|
83
|
|
|
return $e; |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|