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