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\SOAP\Exception\ProtocolViolationException; |
10
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
11
|
|
|
use SimpleSAML\XML\Exception\MissingElementException; |
12
|
|
|
use SimpleSAML\XML\Exception\TooManyElementsException; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class representing a env:Subcode element. |
16
|
|
|
* |
17
|
|
|
* @package simplesaml/xml-soap |
18
|
|
|
*/ |
19
|
|
|
final class Subcode extends AbstractSoapElement |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* The Value element |
23
|
|
|
* |
24
|
|
|
* @var \SimpleSAML\SOAP\XML\env\Value |
|
|
|
|
25
|
|
|
*/ |
26
|
|
|
protected Value $value; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The Subcode element |
30
|
|
|
* |
31
|
|
|
* @var \SimpleSAML\SOAP\XML\env\Subcode|null |
|
|
|
|
32
|
|
|
*/ |
33
|
|
|
protected ?Subcode $subcode; |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Initialize a soap:Subcode |
38
|
|
|
* |
39
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Value $value |
40
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Code|null $code |
|
|
|
|
41
|
|
|
*/ |
42
|
|
|
public function __construct(Value $value, ?Subcode $subcode = null) |
43
|
|
|
{ |
44
|
|
|
$this->setValue($value); |
45
|
|
|
$this->setSubcode($subcode); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return \SimpleSAML\SOAP\XML\env\Value |
51
|
|
|
*/ |
52
|
|
|
public function getValue(): Value |
53
|
|
|
{ |
54
|
|
|
return $this->value; |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Value $value |
60
|
|
|
*/ |
61
|
|
|
protected function setValue(Value $value): void |
62
|
|
|
{ |
63
|
|
|
$this->value = $value; |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return \SimpleSAML\SOAP\XML\env\Subcode|null |
69
|
|
|
*/ |
70
|
|
|
public function getSubcode(): ?Subcode |
71
|
|
|
{ |
72
|
|
|
return $this->subcode; |
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param \SimpleSAML\SOAP\XML\env\Subcode|null $subcode |
78
|
|
|
*/ |
79
|
|
|
protected function setSubcode(?Subcode $subcode): void |
80
|
|
|
{ |
81
|
|
|
$this->subcode = $subcode; |
|
|
|
|
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Convert XML into an Subcode element |
87
|
|
|
* |
88
|
|
|
* @param \DOMElement $xml The XML element we should load |
89
|
|
|
* @return static |
90
|
|
|
* |
91
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
92
|
|
|
* If the qualified name of the supplied element is wrong |
93
|
|
|
*/ |
94
|
|
|
public static function fromXML(DOMElement $xml): static |
95
|
|
|
{ |
96
|
|
|
Assert::same($xml->localName, 'Subcode', InvalidDOMElementException::class); |
97
|
|
|
Assert::same($xml->namespaceURI, Subcode::NS, InvalidDOMElementException::class); |
98
|
|
|
|
99
|
|
|
$value = Value::getChildrenOfClass($xml); |
100
|
|
|
Assert::count($value, 1, 'Must contain exactly one Value', MissingElementException::class); |
101
|
|
|
|
102
|
|
|
$subcode = Subcode::getChildrenOfClass($xml); |
103
|
|
|
Assert::maxCount($subcode, 1, 'Cannot process more than one Subcode element.', TooManyElementsException::class); |
104
|
|
|
|
105
|
|
|
return new static( |
106
|
|
|
array_pop($value), |
107
|
|
|
empty($subcode) ? null : array_pop($subcode) |
108
|
|
|
); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Convert this Subcode to XML. |
114
|
|
|
* |
115
|
|
|
* @param \DOMElement|null $parent The element we should add this subcode to. |
116
|
|
|
* @return \DOMElement This Subcode-element. |
117
|
|
|
*/ |
118
|
|
|
public function toXML(DOMElement $parent = null): DOMElement |
119
|
|
|
{ |
120
|
|
|
$e = $this->instantiateParentElement($parent); |
121
|
|
|
|
122
|
|
|
$this->getValue()->toXML($e); |
123
|
|
|
$this->getSubcode()?->toXML($e); |
124
|
|
|
|
125
|
|
|
return $e; |
126
|
|
|
} |
127
|
|
|
} |
128
|
|
|
|
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