1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\SOAP\XML\env_200305; |
6
|
|
|
|
7
|
|
|
use DOMElement; |
8
|
|
|
use SimpleSAML\Assert\Assert; |
9
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
10
|
|
|
use SimpleSAML\XML\Exception\MissingElementException; |
11
|
|
|
use SimpleSAML\XML\Exception\TooManyElementsException; |
12
|
|
|
use SimpleSAML\XML\ExtendableAttributesTrait; |
13
|
|
|
use SimpleSAML\XML\SchemaValidatableElementInterface; |
14
|
|
|
use SimpleSAML\XML\SchemaValidatableElementTrait; |
15
|
|
|
use SimpleSAML\XML\XsNamespace as NS; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class representing a env:Envelope element. |
19
|
|
|
* |
20
|
|
|
* @package simplesaml/xml-soap |
21
|
|
|
*/ |
22
|
|
|
final class Envelope extends AbstractSoapElement implements SchemaValidatableElementInterface |
23
|
|
|
{ |
24
|
|
|
use ExtendableAttributesTrait; |
25
|
|
|
use SchemaValidatableElementTrait; |
26
|
|
|
|
27
|
|
|
/** The namespace-attribute for the xs:anyAttribute element */ |
28
|
|
|
public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Initialize a env:Envelope |
33
|
|
|
* |
34
|
|
|
* @param \SimpleSAML\SOAP\XML\env_200305\Body $body |
35
|
|
|
* @param \SimpleSAML\SOAP\XML\env_200305\Header|null $header |
36
|
|
|
* @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes |
|
|
|
|
37
|
|
|
*/ |
38
|
|
|
public function __construct( |
39
|
|
|
protected Body $body, |
40
|
|
|
protected ?Header $header = null, |
41
|
|
|
array $namespacedAttributes = [], |
42
|
|
|
) { |
43
|
|
|
$this->setAttributesNS($namespacedAttributes); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return \SimpleSAML\SOAP\XML\env_200305\Body |
49
|
|
|
*/ |
50
|
|
|
public function getBody(): Body |
51
|
|
|
{ |
52
|
|
|
return $this->body; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return \SimpleSAML\SOAP\XML\env_200305\Header|null |
58
|
|
|
*/ |
59
|
|
|
public function getHeader(): ?Header |
60
|
|
|
{ |
61
|
|
|
return $this->header; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Convert XML into an Envelope element |
67
|
|
|
* |
68
|
|
|
* @param \DOMElement $xml The XML element we should load |
69
|
|
|
* @return static |
70
|
|
|
* |
71
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
72
|
|
|
* If the qualified name of the supplied element is wrong |
73
|
|
|
*/ |
74
|
|
|
public static function fromXML(DOMElement $xml): static |
75
|
|
|
{ |
76
|
|
|
Assert::same($xml->localName, 'Envelope', InvalidDOMElementException::class); |
77
|
|
|
Assert::same($xml->namespaceURI, Envelope::NS, InvalidDOMElementException::class); |
78
|
|
|
|
79
|
|
|
$body = Body::getChildrenOfClass($xml); |
80
|
|
|
Assert::count($body, 1, 'Must contain exactly one Body', MissingElementException::class); |
81
|
|
|
|
82
|
|
|
$header = Header::getChildrenOfClass($xml); |
83
|
|
|
Assert::maxCount($header, 1, 'Cannot process more than one Header element.', TooManyElementsException::class); |
84
|
|
|
|
85
|
|
|
return new static( |
86
|
|
|
array_pop($body), |
87
|
|
|
empty($header) ? null : array_pop($header), |
88
|
|
|
self::getAttributesNSFromXML($xml), |
89
|
|
|
); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Convert this Envelope to XML. |
95
|
|
|
* |
96
|
|
|
* @param \DOMElement|null $parent The element we should add this envelope to. |
97
|
|
|
* @return \DOMElement This Envelope-element. |
98
|
|
|
*/ |
99
|
|
|
public function toXML(?DOMElement $parent = null): DOMElement |
100
|
|
|
{ |
101
|
|
|
$e = $this->instantiateParentElement($parent); |
102
|
|
|
|
103
|
|
|
foreach ($this->getAttributesNS() as $attr) { |
104
|
|
|
$attr->toXML($e); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
if ($this->getHeader() !== null && !$this->getHeader()->isEmptyElement()) { |
108
|
|
|
$this->getHeader()->toXML($e); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
$this->getBody()->toXML($e); |
112
|
|
|
|
113
|
|
|
return $e; |
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths