AbstractApplicationServiceType   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 163
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 49
c 1
b 0
f 0
dl 0
loc 163
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getPassiveRequestorEndpoint() 0 3 1
A toUnsignedXML() 0 17 4
A getApplicationServiceEndpoint() 0 3 1
A getSingleSignOutNotificationEndpoint() 0 3 1
A __construct() 0 62 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\fed;
6
7
use DateTimeImmutable;
8
use DOMElement;
9
use SimpleSAML\SAML2\XML\md\Extensions;
10
use SimpleSAML\SAML2\XML\md\Organization;
11
use SimpleSAML\WSSecurity\Assert\Assert;
12
use SimpleSAML\WSSecurity\Constants as C;
13
use SimpleSAML\XML\Exception\MissingElementException;
14
use SimpleSAML\XML\Exception\SchemaViolationException;
15
16
/**
17
 * A ApplicationServiceType
18
 *
19
 * @package simplesamlphp/ws-security
20
 */
21
abstract class AbstractApplicationServiceType extends AbstractWebServiceDescriptorType
22
{
23
    /** @var string */
24
    public const XSI_TYPE_PREFIX = 'fed';
25
26
    /** @var string */
27
    public const XSI_TYPE_NAME = 'ApplicationServiceType';
28
29
    /** @var string */
30
    public const XSI_TYPE_NAMESPACE = C::NS_FED;
31
32
33
    /**
34
     * ApplicationServiceType constructor.
35
     *
36
     * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported.
37
     * @param string|null $ID The ID for this document. Defaults to null.
38
     * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null.
39
     * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null.
40
     * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array.
41
     * @param string|null $errorURL An URI where to redirect users for support. Defaults to null.
42
     * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements.
43
     *   Defaults to an empty array.
44
     * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization
45
     *   The organization running this entity. Defaults to null.
46
     * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contact An array of contacts for this entity.
47
     *   Defaults to an empty array.
48
     * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes
0 ignored issues
show
Bug introduced by
The type SimpleSAML\WSSecurity\XML\fed\list was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
     * @param \SimpleSAML\WSSecurity\XML\fed\LogicalServiceNamesOffered|null $logicalServiceNamesOffered
50
     * @param \SimpleSAML\WSSecurity\XML\fed\TokenTypesOffered|null $tokenTypesOffered
51
     * @param \SimpleSAML\WSSecurity\XML\fed\ClaimDialectsOffered|null $claimDialectsOffered
52
     * @param \SimpleSAML\WSSecurity\XML\fed\ClaimTypesOffered|null $claimTypesOffered
53
     * @param \SimpleSAML\WSSecurity\XML\fed\ClaimTypesRequested|null $claimTypesRequested
54
     * @param \SimpleSAML\WSSecurity\XML\fed\AutomaticPseudonyms|null $automaticPseudonyms
55
     * @param \SimpleSAML\WSSecurity\XML\fed\TargetScopes|null $targetScopes
56
     * @param string|null $serviceDisplayName
57
     * @param string|null $serviceDescription
58
     * @param \SimpleSAML\WSSecurity\XML\fed\ApplicationServiceEndpoint[] $applicationServiceEndpoint
59
     * @param \SimpleSAML\WSSecurity\XML\fed\SingleSignOutNotificationEndpoint[] $singleSignOutNotificationEndpoint
60
     * @param \SimpleSAML\WSSecurity\XML\fed\PassiveRequestorEndpoint[] $passiveRequestorEndpoint
61
     */
62
    final public function __construct(
63
        array $protocolSupportEnumeration,
64
        ?string $ID = null,
65
        ?DateTimeImmutable $validUntil = null,
66
        ?string $cacheDuration = null,
67
        ?Extensions $extensions = null,
68
        ?string $errorURL = null,
69
        array $keyDescriptor = [],
70
        ?Organization $organization = null,
71
        array $contact = [],
72
        array $namespacedAttributes = [],
73
        ?LogicalServiceNamesOffered $logicalServiceNamesOffered = null,
74
        ?TokenTypesOffered $tokenTypesOffered = null,
75
        ?ClaimDialectsOffered $claimDialectsOffered = null,
76
        ?ClaimTypesOffered $claimTypesOffered = null,
77
        ?ClaimTypesRequested $claimTypesRequested = null,
78
        ?AutomaticPseudonyms $automaticPseudonyms = null,
79
        ?TargetScopes $targetScopes = null,
80
        ?string $serviceDisplayName = null,
81
        ?string $serviceDescription = null,
82
        protected array $applicationServiceEndpoint = [],
83
        protected array $singleSignOutNotificationEndpoint = [],
84
        protected array $passiveRequestorEndpoint = [],
85
    ) {
86
        Assert::minCount($applicationServiceEndpoint, 1, MissingElementException::class);
0 ignored issues
show
Bug introduced by
The method minCount() does not exist on SimpleSAML\WSSecurity\Assert\Assert. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

86
        Assert::/** @scrutinizer ignore-call */ 
87
                minCount($applicationServiceEndpoint, 1, MissingElementException::class);
Loading history...
87
        Assert::allIsInstanceOf(
0 ignored issues
show
Bug introduced by
The method allIsInstanceOf() does not exist on SimpleSAML\WSSecurity\Assert\Assert. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

87
        Assert::/** @scrutinizer ignore-call */ 
88
                allIsInstanceOf(
Loading history...
88
            $applicationServiceEndpoint,
89
            ApplicationServiceEndpoint::class,
90
            SchemaViolationException::class,
91
        );
92
        Assert::allIsInstanceOf(
93
            $singleSignOutNotificationEndpoint,
94
            SingleSignOutNotificationEndpoint::class,
95
            SchemaViolationException::class,
96
        );
97
        Assert::allIsInstanceOf(
98
            $passiveRequestorEndpoint,
99
            PassiveRequestorEndpoint::class,
100
            SchemaViolationException::class,
101
        );
102
103
        parent::__construct(
104
            static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME,
105
            $protocolSupportEnumeration,
106
            $ID,
107
            $validUntil,
108
            $cacheDuration,
109
            $extensions,
110
            $errorURL,
111
            $keyDescriptor,
112
            $organization,
113
            $contact,
114
            $namespacedAttributes,
115
            $logicalServiceNamesOffered,
116
            $tokenTypesOffered,
117
            $claimDialectsOffered,
118
            $claimTypesOffered,
119
            $claimTypesRequested,
120
            $automaticPseudonyms,
121
            $targetScopes,
122
            $serviceDisplayName,
123
            $serviceDescription,
124
        );
125
    }
126
127
128
    /**
129
     * Collect the value of the applicationServicEndpoint-property
130
     *
131
     * @return \SimpleSAML\WSSecurity\XML\fed\ApplicationServiceEndpoint[]
132
     */
133
    public function getApplicationServiceEndpoint(): array
134
    {
135
        return $this->applicationServiceEndpoint;
136
    }
137
138
139
    /**
140
     * Collect the value of the singleSignOutNotificationtionEndpoint-property
141
     *
142
     * @return \SimpleSAML\WSSecurity\XML\fed\SingleSignOutNotificationEndpoint[]
143
     */
144
    public function getSingleSignOutNotificationEndpoint(): array
145
    {
146
        return $this->singleSignOutNotificationEndpoint;
147
    }
148
149
150
    /**
151
     * Collect the value of the passiveRequestorEndpoint-property
152
     *
153
     * @return \SimpleSAML\WSSecurity\XML\fed\PassiveRequestorEndpoint[]
154
     */
155
    public function getPassiveRequestorEndpoint(): array
156
    {
157
        return $this->passiveRequestorEndpoint;
158
    }
159
160
161
    /**
162
     * Convert this element to XML.
163
     *
164
     * @param \DOMElement|null $parent The element we should append this element to.
165
     * @return \DOMElement
166
     */
167
    public function toUnsignedXML(?DOMElement $parent = null): DOMElement
168
    {
169
        $e = parent::toXML($parent);
170
171
        foreach ($this->getApplicationServiceEndpoint() as $ase) {
172
            $ase->toXML($e);
173
        }
174
175
        foreach ($this->getSingleSignOutNotificationEndpoint() as $ssone) {
176
            $ssone->toXML($e);
177
        }
178
179
        foreach ($this->getPassiveRequestorEndpoint() as $pre) {
180
            $pre->toXML($e);
181
        }
182
183
        return $e;
184
    }
185
}
186