Issuer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 52
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 38 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\saml;
6
7
use SimpleSAML\SAML2\Assert\Assert;
8
use SimpleSAML\SAML2\Constants as C;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\Constants 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...
9
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
10
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
11
use SimpleSAML\SAML2\Type\SAMLStringValue;
12
use SimpleSAML\XML\SchemaValidatableElementInterface;
13
use SimpleSAML\XML\SchemaValidatableElementTrait;
14
15
/**
16
 * Class representing the saml:Issuer element.
17
 *
18
 * @package simplesamlphp/saml2
19
 */
20
final class Issuer extends NameIDType implements SchemaValidatableElementInterface
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\saml\NameIDType 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...
21
{
22
    use SchemaValidatableElementTrait;
23
24
25
    /**
26
     * Initialize a saml:Issuer
27
     *
28
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue $value
29
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier
30
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier
31
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $Format
32
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPProvidedID
33
     */
34
    public function __construct(
35
        SAMLStringValue $value,
36
        ?SAMLStringValue $NameQualifier = null,
37
        ?SAMLStringValue $SPNameQualifier = null,
38
        ?SAMLAnyURIValue $Format = null,
39
        ?SAMLStringValue $SPProvidedID = null,
40
    ) {
41
        /**
42
         * The format of this NameIDType.
43
         *
44
         * Defaults to urn:oasis:names:tc:SAML:2.0:nameid-format:entity:
45
         *
46
         * Indicates that the content of the element is the identifier of an entity that provides SAML-based services
47
         * (such as a SAML authority, requester, or responder) or is a participant in SAML profiles (such as a service
48
         * provider supporting the browser SSO profile). Such an identifier can be used in the <Issuer> element to
49
         * identify the issuer of a SAML request, response, or assertion, or within the <NameID> element to make
50
         * assertions about system entities that can issue SAML requests, responses, and assertions. It can also be
51
         * used in other elements and attributes whose purpose is to identify a system entity in various protocol
52
         * exchanges.
53
         *
54
         * The syntax of such an identifier is a URI of not more than 1024 characters in length. It is RECOMMENDED that
55
         * a system entity use a URL containing its own domain name to identify itself.
56
         *
57
         * @see saml-core-2.0-os
58
         *
59
         * From saml-core-2.0-os 8.3.6, when the entity Format is used: "The NameQualifier, SPNameQualifier, and
60
         * SPProvidedID attributes MUST be omitted."
61
         */
62
        if ($Format === null || $Format->getValue() === C::NAMEID_ENTITY) {
63
            Assert::allNull(
64
                [$NameQualifier, $SPNameQualifier, $SPProvidedID],
65
                'Illegal combination of attributes being used',
66
            );
67
68
            Assert::validEntityID($value->getValue(), ProtocolViolationException::class);
69
        }
70
71
        parent::__construct($value, $NameQualifier, $SPNameQualifier, $Format, $SPProvidedID);
72
    }
73
}
74