Passed
Pull Request — master (#306)
by Tim
03:15
created

UnknownRoleDescriptor::getRawRoleDescriptor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\md;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\SAML2\Utils\XPath;
10
use SimpleSAML\XML\AbstractElement;
11
use SimpleSAML\XML\Chunk;
12
use SimpleSAML\XML\Exception\InvalidDOMElementException;
13
use SimpleSAML\XML\Exception\TooManyElementsException;
14
use SimpleSAML\XML\Utils as XMLUtils;
15
use SimpleSAML\XMLSecurity\XML\ds\Signature;
16
17
use function array_pop;
18
use function preg_split;
19
20
/**
21
 * Class representing unknown RoleDescriptors.
22
 *
23
 * @package simplesamlphp/saml2
24
 */
25
final class UnknownRoleDescriptor extends AbstractRoleDescriptor
26
{
27
    /**
28
     * Initialize an unknown RoleDescriptor.
29
     *
30
     * @param \SimpleSAML\XML\Chunk $chunk The whole RoleDescriptor element as a chunk object.
31
     * @param string $type
32
     * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported.
33
     * @param string|null $ID The ID for this document. Defaults to null.
34
     * @param int|null $validUntil Unix time of validity for this document. Defaults to null.
35
     * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null.
36
     * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null.
37
     * @param string|null $errorURL An URI where to redirect users for support. Defaults to null.
38
     * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptors An array of KeyDescriptor elements.
39
     *   Defaults to an empty array.
40
     * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization
41
     *   The organization running this entity. Defaults to null.
42
     * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contacts
43
     *   An array of contacts for this entity. Defaults to an empty array.
44
     * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\md\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...
45
     */
46
    protected function __construct(
47
        protected Chunk $chunk,
48
        string $type,
49
        array $protocolSupportEnumeration,
50
        ?string $ID = null,
51
        ?int $validUntil = null,
52
        ?string $cacheDuration = null,
53
        ?Extensions $extensions = null,
54
        ?string $errorURL = null,
55
        array $keyDescriptors = [],
56
        ?Organization $organization = null,
57
        array $contacts = [],
58
        array $namespacedAttributes = []
59
    ) {
60
        parent::__construct(
61
            $type,
62
            $protocolSupportEnumeration,
63
            $ID,
64
            $validUntil,
65
            $cacheDuration,
66
            $extensions,
67
            $errorURL,
68
            $keyDescriptors,
69
            $organization,
70
            $contacts,
71
            $namespacedAttributes,
72
        );
73
    }
74
75
76
    /**
77
     * Get the raw version of this RoleDescriptor as a Chunk.
78
     *
79
     * @return \SimpleSAML\XML\Chunk
80
     */
81
    public function getRawRoleDescriptor(): Chunk
82
    {
83
        return $this->chunk;
84
    }
85
86
87
    /**
88
     * Convert this RoleDescriptor to XML.
89
     *
90
     * @param \DOMElement|null $parent The element we are converting to XML.
91
     * @return \DOMElement The XML element after adding the data corresponding to this unknown RoleDescriptor.
92
     */
93
    public function toXML(DOMElement $parent = null): DOMElement
94
    {
95
        return $this->getRawRoleDescriptor()->toXML($parent);
96
    }
97
}
98