|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\SAML2\XML\saml; |
|
6
|
|
|
|
|
7
|
|
|
use DOMElement; |
|
8
|
|
|
use SimpleSAML\SAML2\Assert\Assert; |
|
9
|
|
|
use SimpleSAML\SAML2\Type\DomainValue; |
|
10
|
|
|
use SimpleSAML\SAML2\Type\SAMLStringValue; |
|
11
|
|
|
use SimpleSAML\XML\SchemaValidatableElementInterface; |
|
12
|
|
|
use SimpleSAML\XML\SchemaValidatableElementTrait; |
|
13
|
|
|
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class representing SAML2 SubjectLocality |
|
17
|
|
|
* |
|
18
|
|
|
* @package simplesamlphp/saml2 |
|
19
|
|
|
*/ |
|
20
|
|
|
final class SubjectLocality extends AbstractSamlElement implements SchemaValidatableElementInterface |
|
|
|
|
|
|
21
|
|
|
{ |
|
22
|
|
|
use SchemaValidatableElementTrait; |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Initialize an SubjectLocality. |
|
27
|
|
|
* |
|
28
|
|
|
* @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $address |
|
29
|
|
|
* @param \SimpleSAML\SAML2\Type\DomainValue|null $dnsName |
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct( |
|
32
|
|
|
protected ?SAMLStringValue $address = null, |
|
33
|
|
|
protected ?DomainValue $dnsName = null, |
|
34
|
|
|
) { |
|
35
|
|
|
Assert::nullOrIp($address?->getValue(), 'Invalid IP address'); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Collect the value of the address-property |
|
41
|
|
|
* |
|
42
|
|
|
* @return \SimpleSAML\SAML2\Type\SAMLStringValue|null |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getAddress(): ?SAMLStringValue |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->address; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Collect the value of the dnsName-property |
|
52
|
|
|
* |
|
53
|
|
|
* @return \SimpleSAML\SAML2\Type\DomainValue|null |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getDnsName(): ?DomainValue |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->dnsName; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Test if an object, at the state it's in, would produce an empty XML-element |
|
63
|
|
|
*/ |
|
64
|
|
|
public function isEmptyElement(): bool |
|
65
|
|
|
{ |
|
66
|
|
|
return empty($this->getAddress()) |
|
67
|
|
|
&& empty($this->getDnsName()); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Convert XML into a SubjectLocality |
|
73
|
|
|
* |
|
74
|
|
|
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
|
75
|
|
|
* if the qualified name of the supplied element is wrong |
|
76
|
|
|
*/ |
|
77
|
|
|
public static function fromXML(DOMElement $xml): static |
|
78
|
|
|
{ |
|
79
|
|
|
Assert::same($xml->localName, 'SubjectLocality', InvalidDOMElementException::class); |
|
80
|
|
|
Assert::same($xml->namespaceURI, SubjectLocality::NS, InvalidDOMElementException::class); |
|
81
|
|
|
|
|
82
|
|
|
return new static( |
|
83
|
|
|
self::getOptionalAttribute($xml, 'Address', SAMLStringValue::class, null), |
|
84
|
|
|
self::getOptionalAttribute($xml, 'DNSName', DomainValue::class, null), |
|
85
|
|
|
); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Convert this SubjectLocality to XML. |
|
91
|
|
|
*/ |
|
92
|
|
|
public function toXML(?DOMElement $parent = null): DOMElement |
|
93
|
|
|
{ |
|
94
|
|
|
$e = $this->instantiateParentElement($parent); |
|
95
|
|
|
|
|
96
|
|
|
if ($this->getAddress() !== null) { |
|
97
|
|
|
$e->setAttribute('Address', $this->getAddress()->getValue()); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
if ($this->getDnsName() !== null) { |
|
101
|
|
|
$e->setAttribute('DNSName', $this->getDnsName()->getValue()); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
return $e; |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|
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