|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\SOAP12\XML\env; |
|
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
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class representing a env:Fault element. |
|
15
|
|
|
* |
|
16
|
|
|
* @package simplesaml/xml-soap |
|
17
|
|
|
*/ |
|
18
|
|
|
final class Fault extends AbstractSoapElement |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* The Code element |
|
22
|
|
|
* |
|
23
|
|
|
* @var \SimpleSAML\SOAP\XML\env\Code |
|
|
|
|
|
|
24
|
|
|
*/ |
|
25
|
|
|
protected Code $code; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* The Reason element |
|
29
|
|
|
* |
|
30
|
|
|
* @var \SimpleSAML\SOAP\XML\env\Reason |
|
|
|
|
|
|
31
|
|
|
*/ |
|
32
|
|
|
protected Reason $reason; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* The Node element |
|
36
|
|
|
* |
|
37
|
|
|
* @var \SimpleSAML\SOAP\XML\env\Node|null |
|
|
|
|
|
|
38
|
|
|
*/ |
|
39
|
|
|
protected ?Node $node; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* The Role element |
|
43
|
|
|
* |
|
44
|
|
|
* @var \SimpleSAML\SOAP\XML\env\Role|null |
|
|
|
|
|
|
45
|
|
|
*/ |
|
46
|
|
|
protected ?Role $role; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* The Detail element |
|
50
|
|
|
* |
|
51
|
|
|
* @var \SimpleSAML\SOAP\XML\env\Detail|null |
|
|
|
|
|
|
52
|
|
|
*/ |
|
53
|
|
|
protected ?Detail $detail; |
|
54
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Initialize a env:Fault |
|
58
|
|
|
* |
|
59
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Code $code |
|
60
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Reason $reason |
|
61
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Node|null $node |
|
62
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Role|null $role |
|
63
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Detail|null $detail |
|
64
|
|
|
*/ |
|
65
|
|
|
public function __construct( |
|
66
|
|
|
Code $code, |
|
67
|
|
|
Reason $reason, |
|
68
|
|
|
?Node $node = null, |
|
69
|
|
|
?Role $role = null, |
|
70
|
|
|
?Detail $detail = null |
|
71
|
|
|
) { |
|
72
|
|
|
$this->setCode($code); |
|
73
|
|
|
$this->setReason($reason); |
|
74
|
|
|
$this->setNode($node); |
|
75
|
|
|
$this->setRole($role); |
|
76
|
|
|
$this->setDetail($detail); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return \SimpleSAML\SOAP\XML\env\Code |
|
82
|
|
|
*/ |
|
83
|
|
|
public function getCode(): Code |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->code; |
|
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Code $code |
|
91
|
|
|
*/ |
|
92
|
|
|
protected function setCode(Code $code): void |
|
93
|
|
|
{ |
|
94
|
|
|
$this->code = $code; |
|
|
|
|
|
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return \SimpleSAML\SOAP\XML\env\Reason |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getReason(): Reason |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->reason; |
|
|
|
|
|
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Reason $reason |
|
109
|
|
|
*/ |
|
110
|
|
|
protected function setReason(Reason $reason): void |
|
111
|
|
|
{ |
|
112
|
|
|
$this->reason = $reason; |
|
|
|
|
|
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return \SimpleSAML\SOAP\XML\env\Node|null |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getNode(): ?Node |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->node; |
|
|
|
|
|
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Node|null $node |
|
127
|
|
|
*/ |
|
128
|
|
|
protected function setNode(?Node $node): void |
|
129
|
|
|
{ |
|
130
|
|
|
$this->node = $node; |
|
|
|
|
|
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @return \SimpleSAML\SOAP\XML\env\Role|null |
|
136
|
|
|
*/ |
|
137
|
|
|
public function getRole(): ?Role |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->role; |
|
|
|
|
|
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Role|null $role |
|
145
|
|
|
*/ |
|
146
|
|
|
protected function setRole(?Role $role): void |
|
147
|
|
|
{ |
|
148
|
|
|
$this->role = $role; |
|
|
|
|
|
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @return \SimpleSAML\SOAP\XML\env\Detail|null |
|
154
|
|
|
*/ |
|
155
|
|
|
public function getDetail(): ?Detail |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->detail; |
|
|
|
|
|
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Detail|null $detail |
|
163
|
|
|
*/ |
|
164
|
|
|
protected function setDetail(?Detail $detail): void |
|
165
|
|
|
{ |
|
166
|
|
|
$this->detail = $detail; |
|
|
|
|
|
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Convert XML into an Fault element |
|
172
|
|
|
* |
|
173
|
|
|
* @param \DOMElement $xml The XML element we should load |
|
174
|
|
|
* @return static |
|
175
|
|
|
* |
|
176
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
|
177
|
|
|
* If the qualified name of the supplied element is wrong |
|
178
|
|
|
*/ |
|
179
|
|
|
public static function fromXML(DOMElement $xml): static |
|
180
|
|
|
{ |
|
181
|
|
|
Assert::same($xml->localName, 'Fault', InvalidDOMElementException::class); |
|
182
|
|
|
Assert::same($xml->namespaceURI, Fault::NS, InvalidDOMElementException::class); |
|
183
|
|
|
|
|
184
|
|
|
$code = Code::getChildrenOfClass($xml); |
|
185
|
|
|
Assert::count($code, 1, 'Must contain exactly one Code', MissingElementException::class); |
|
186
|
|
|
|
|
187
|
|
|
$reason = Reason::getChildrenOfClass($xml); |
|
188
|
|
|
Assert::count($reason, 1, 'Must contain exactly one Reason', MissingElementException::class); |
|
189
|
|
|
|
|
190
|
|
|
$node = Node::getChildrenOfClass($xml); |
|
191
|
|
|
Assert::maxCount($node, 1, 'Cannot process more than one Node element.', TooManyElementsException::class); |
|
192
|
|
|
|
|
193
|
|
|
$role = Role::getChildrenOfClass($xml); |
|
194
|
|
|
Assert::maxCount($role, 1, 'Cannot process more than one Role element.', TooManyElementsException::class); |
|
195
|
|
|
|
|
196
|
|
|
$detail = Detail::getChildrenOfClass($xml); |
|
197
|
|
|
Assert::maxCount($detail, 1, 'Cannot process more than one Detail element.', TooManyElementsException::class); |
|
198
|
|
|
|
|
199
|
|
|
return new self( |
|
200
|
|
|
array_pop($code), |
|
201
|
|
|
array_pop($reason), |
|
202
|
|
|
empty($node) ? null : array_pop($node), |
|
203
|
|
|
empty($role) ? null : array_pop($role), |
|
204
|
|
|
empty($detail) ? null : array_pop($detail) |
|
205
|
|
|
); |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* Convert this Fault to XML. |
|
211
|
|
|
* |
|
212
|
|
|
* @param \DOMElement|null $parent The element we should add this fault to. |
|
213
|
|
|
* @return \DOMElement This Fault-element. |
|
214
|
|
|
*/ |
|
215
|
|
|
public function toXML(DOMElement $parent = null): DOMElement |
|
216
|
|
|
{ |
|
217
|
|
|
$e = $this->instantiateParentElement($parent); |
|
218
|
|
|
|
|
219
|
|
|
$this->getCode()->toXML($e); |
|
220
|
|
|
$this->getReason()->toXML($e); |
|
221
|
|
|
|
|
222
|
|
|
$this->getNode()?->toXML($e); |
|
223
|
|
|
$this->getRole()?->toXML($e); |
|
224
|
|
|
|
|
225
|
|
|
if ($this->getDetail() !== null && !$this->getDetail()->isEmptyElement()) { |
|
226
|
|
|
$this->getDetail()->toXML($e); |
|
227
|
|
|
} |
|
228
|
|
|
|
|
229
|
|
|
return $e; |
|
230
|
|
|
} |
|
231
|
|
|
} |
|
232
|
|
|
|
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