-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReferenceParameters.php
More file actions
83 lines (66 loc) · 2.13 KB
/
Copy pathReferenceParameters.php
File metadata and controls
83 lines (66 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
declare(strict_types=1);
namespace SimpleSAML\WebServices\Addressing\XML\wsa_200408;
use Dom;
use SimpleSAML\WebServices\Addressing\Assert\Assert;
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\XML\Constants\NS;
/**
* Class representing a wsa:ReferenceParameters element.
*
* @package simplesamlphp/xml-ws-addressing
*/
final class ReferenceParameters extends AbstractWsaElement
{
use ExtendableElementTrait;
/** The namespace-attribute for the xs:any element */
public const string XS_ANY_ELT_NAMESPACE = NS::ANY;
/**
* Initialize a wsa:ReferenceParameters
*
* @param \SimpleSAML\XML\SerializableElementInterface[] $children
*/
public function __construct(array $children = [])
{
$this->setElements($children);
}
/**
* Test if an object, at the state it's in, would produce an empty XML-element
*/
public function isEmptyElement(): bool
{
return empty($this->elements);
}
/*
* Convert XML into an ReferenceParameters element
*
* @param \Dom\Element $xml The XML element we should load
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
return new static(
self::getChildElementsFromXML($xml),
);
}
/**
* Convert this ReferenceParameters to XML.
*
* @param \Dom\Element|null $parent The element we should add this ReferenceParameters to.
*/
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
foreach ($this->getElements() as $child) {
if (!$child->isEmptyElement()) {
$child->toXML($e);
}
}
return $e;
}
}