1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\SOAP11\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 faultcode element |
22
|
|
|
* |
23
|
|
|
* @var \SimpleSAML\SOAP11\XML\env\FaultCode |
24
|
|
|
*/ |
25
|
|
|
protected FaultCode $faultCode; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* The faultstring element |
29
|
|
|
* |
30
|
|
|
* @var \SimpleSAML\SOAP11\XML\env\FaultString |
31
|
|
|
*/ |
32
|
|
|
protected FaultString $faultString; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* The faultactor element |
36
|
|
|
* |
37
|
|
|
* @var \SimpleSAML\SOAP11\XML\env\FaultActor|null |
38
|
|
|
*/ |
39
|
|
|
protected ?FaultActor $faultActor; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* The detail element |
43
|
|
|
* |
44
|
|
|
* @var \SimpleSAML\SOAP11\XML\env\Detail|null |
45
|
|
|
*/ |
46
|
|
|
protected ?Detail $detail; |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Initialize a env:Fault |
51
|
|
|
* |
52
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\FaultCode $faultCode |
53
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\FaultString $faultString |
54
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\FaultActor|null $faultActor |
55
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\Detail|null $detail |
56
|
|
|
*/ |
57
|
|
|
public function __construct( |
58
|
|
|
FaultCode $faultCode, |
59
|
|
|
FaultString $faultString, |
60
|
|
|
?FaultActor $faultActor = null, |
61
|
|
|
?Detail $detail = null |
62
|
|
|
) { |
63
|
|
|
$this->setFaultCode($faultCode); |
64
|
|
|
$this->setFaultString($faultString); |
65
|
|
|
$this->setFaultActor($faultActor); |
66
|
|
|
$this->setDetail($detail); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return \SimpleSAML\SOAP11\XML\env\FaultCode |
72
|
|
|
*/ |
73
|
|
|
public function getFaultCode(): FaultCode |
74
|
|
|
{ |
75
|
|
|
return $this->faultCode; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\Code $faultCode |
|
|
|
|
81
|
|
|
*/ |
82
|
|
|
protected function setFaultCode(FaultCode $faultCode): void |
83
|
|
|
{ |
84
|
|
|
$this->faultCode = $faultCode; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return \SimpleSAML\SOAP11\XML\env\FaultString |
90
|
|
|
*/ |
91
|
|
|
public function getFaultString(): FaultString |
92
|
|
|
{ |
93
|
|
|
return $this->faultString; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\FaultString $faultString |
99
|
|
|
*/ |
100
|
|
|
protected function setFaultString(FaultString $faultString): void |
101
|
|
|
{ |
102
|
|
|
$this->faultString = $faultString; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return \SimpleSAML\SOAP11\XML\env\FaultActor|null |
108
|
|
|
*/ |
109
|
|
|
public function getFaultActor(): ?FaultActor |
110
|
|
|
{ |
111
|
|
|
return $this->faultActor; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\FaultActor|null $faultActor |
117
|
|
|
*/ |
118
|
|
|
protected function setFaultActor(?FaultActor $faultActor): void |
119
|
|
|
{ |
120
|
|
|
$this->faultActor = $faultActor; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return \SimpleSAML\SOAP11\XML\env\Detail|null |
126
|
|
|
*/ |
127
|
|
|
public function getDetail(): ?Detail |
128
|
|
|
{ |
129
|
|
|
return $this->detail; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @param \SimpleSAML\SOAP11\XML\env\Detail|null $detail |
135
|
|
|
*/ |
136
|
|
|
protected function setDetail(?Detail $detail): void |
137
|
|
|
{ |
138
|
|
|
$this->detail = $detail; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Convert XML into an Fault element |
144
|
|
|
* |
145
|
|
|
* @param \DOMElement $xml The XML element we should load |
146
|
|
|
* @return static |
147
|
|
|
* |
148
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
149
|
|
|
* If the qualified name of the supplied element is wrong |
150
|
|
|
*/ |
151
|
|
|
public static function fromXML(DOMElement $xml): static |
152
|
|
|
{ |
153
|
|
|
Assert::same($xml->localName, 'Fault', InvalidDOMElementException::class); |
154
|
|
|
Assert::same($xml->namespaceURI, Fault::NS, InvalidDOMElementException::class); |
155
|
|
|
|
156
|
|
|
$faultCode = FaultCode::getChildrenOfClass($xml); |
157
|
|
|
Assert::count($faultCode, 1, 'Must contain exactly one faultcode', MissingElementException::class); |
158
|
|
|
|
159
|
|
|
$faultString = FaultString::getChildrenOfClass($xml); |
160
|
|
|
Assert::count($faultString, 1, 'Must contain exactly one faultstring', MissingElementException::class); |
161
|
|
|
|
162
|
|
|
$faultActor = FaultActor::getChildrenOfClass($xml); |
163
|
|
|
Assert::maxCount($faultActor, 1, 'Cannot process more than one faultactor element.', TooManyElementsException::class); |
164
|
|
|
|
165
|
|
|
$detail = Detail::getChildrenOfClass($xml); |
166
|
|
|
Assert::maxCount($detail, 1, 'Cannot process more than one detail element.', TooManyElementsException::class); |
167
|
|
|
|
168
|
|
|
return new self( |
169
|
|
|
array_pop($faultCode), |
170
|
|
|
array_pop($faultString), |
171
|
|
|
array_pop($faultActor), |
172
|
|
|
array_pop($detail) |
173
|
|
|
); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Convert this Fault to XML. |
179
|
|
|
* |
180
|
|
|
* @param \DOMElement|null $parent The element we should add this fault to. |
181
|
|
|
* @return \DOMElement This Fault-element. |
182
|
|
|
*/ |
183
|
|
|
public function toXML(DOMElement $parent = null): DOMElement |
184
|
|
|
{ |
185
|
|
|
$e = $this->instantiateParentElement($parent); |
186
|
|
|
|
187
|
|
|
$this->getFaultCode()->toXML($e); |
188
|
|
|
$this->getFaultString()->toXML($e); |
189
|
|
|
$this->getFaultActor()?->toXML($e); |
190
|
|
|
|
191
|
|
|
if ($this->getDetail() !== null && !$this->getDetail()->isEmptyElement()) { |
192
|
|
|
$this->getDetail()->toXML($e); |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
return $e; |
196
|
|
|
} |
197
|
|
|
} |
198
|
|
|
|
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