|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\WSSecurity\XML\wsdl; |
|
6
|
|
|
|
|
7
|
|
|
use DOMElement; |
|
8
|
|
|
use SimpleSAML\Assert\Assert; |
|
9
|
|
|
use SimpleSAML\XML\Chunk; |
|
10
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
|
11
|
|
|
|
|
12
|
|
|
use function array_pop; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class representing the BindingOperation element. |
|
16
|
|
|
* |
|
17
|
|
|
* @package simplesamlphp/ws-security |
|
18
|
|
|
*/ |
|
19
|
|
|
final class BindingOperation extends AbstractBindingOperation |
|
20
|
|
|
{ |
|
21
|
|
|
/** @var string */ |
|
22
|
|
|
final public const LOCALNAME = 'operation'; |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Initialize a BindingOperation element. |
|
27
|
|
|
* |
|
28
|
|
|
* @param \DOMElement $xml The XML element we should load. |
|
29
|
|
|
* @return static |
|
30
|
|
|
* |
|
31
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
|
32
|
|
|
* if the qualified name of the supplied element is wrong |
|
33
|
|
|
*/ |
|
34
|
|
|
public static function fromXML(DOMElement $xml): static |
|
35
|
|
|
{ |
|
36
|
|
|
Assert::same($xml->localName, static::LOCALNAME, InvalidDOMElementException::class); |
|
37
|
|
|
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); |
|
38
|
|
|
|
|
39
|
|
|
$input = BindingOperationInput::getChildrenOfClass($xml); |
|
40
|
|
|
$output = BindingOperationOutput::getChildrenOfClass($xml); |
|
41
|
|
|
$faults = BindingOperationFault::getChildrenOfClass($xml); |
|
42
|
|
|
|
|
43
|
|
|
$children = []; |
|
44
|
|
|
foreach ($xml->childNodes as $child) { |
|
45
|
|
|
if (!($child instanceof DOMElement)) { |
|
46
|
|
|
continue; |
|
47
|
|
|
} elseif ($child->namespaceURI === static::NS) { |
|
48
|
|
|
// Only other namespaces are allowed |
|
49
|
|
|
continue; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
$children[] = new Chunk($child); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
return new static( |
|
56
|
|
|
self::getAttribute($xml, 'name'), |
|
57
|
|
|
array_pop($input), |
|
58
|
|
|
array_pop($output), |
|
59
|
|
|
$faults, |
|
60
|
|
|
$children, |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|