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\Exception\SchemaViolationException; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Abstract class representing the tBindingOperationMessage type. |
13
|
|
|
* |
14
|
|
|
* @package simplesamlphp/ws-security |
15
|
|
|
*/ |
16
|
|
|
abstract class AbstractBindingOperationMessage extends AbstractExtensibleDocumented |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* Initialize a wsdl:tBindingOperationMessage |
20
|
|
|
* |
21
|
|
|
* @param string|null $name |
22
|
|
|
* @param \SimpleSAML\XML\Chunk[] $elements |
23
|
|
|
*/ |
24
|
|
|
public function __construct( |
25
|
|
|
protected ?string $name = null, |
26
|
|
|
array $elements = [], |
27
|
|
|
) { |
28
|
|
|
Assert::nullOrValidNCName($name, SchemaViolationException::class); |
29
|
|
|
parent::__construct($elements); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Collect the value of the name-property. |
35
|
|
|
* |
36
|
|
|
* @return string|null |
37
|
|
|
*/ |
38
|
|
|
public function getName(): ?string |
39
|
|
|
{ |
40
|
|
|
return $this->name; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Test if an object, at the state it's in, would produce an empty XML-element |
46
|
|
|
* |
47
|
|
|
* @return bool |
48
|
|
|
*/ |
49
|
|
|
public function isEmptyElement(): bool |
50
|
|
|
{ |
51
|
|
|
return parent::isEmptyElement() && empty($this->getName()); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Convert this tBindingOperationMessage to XML. |
57
|
|
|
* |
58
|
|
|
* @param \DOMElement|null $parent The element we are converting to XML. |
59
|
|
|
* @return \DOMElement The XML element after adding the data corresponding to this tBindingOperationMessage. |
60
|
|
|
*/ |
61
|
|
|
public function toXML(DOMElement $parent = null): DOMElement |
62
|
|
|
{ |
63
|
|
|
$e = parent::toXML($parent); |
64
|
|
|
|
65
|
|
|
if ($this->getName() !== null) { |
66
|
|
|
$e->setAttribute('name', $this->getName()); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
return $e; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|