AbstractBaseIDType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toXML() 0 13 3
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\SAMLStringValue;
10
11
/**
12
 * SAML BaseID data type.
13
 *
14
 * @package simplesamlphp/saml2
15
 */
16
abstract class AbstractBaseIDType extends AbstractSamlElement implements BaseIdentifierInterface
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\saml\AbstractSamlElement 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...
17
{
18
    use IDNameQualifiersTrait;
19
20
21
    /**
22
     * Initialize a saml:BaseIDAbstractType from scratch
23
     *
24
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier
25
     *   The security or administrative domain that qualifies the identifier.
26
     *   This attribute provides a means to federate identifiers from disparate user stores without collision.
27
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier
28
     *   Further qualifies an identifier with the name of a service provider or affiliation of providers. This
29
     *   attribute provides an additional means to federate identifiers on the basis of the relying party or parties.
30
     */
31
    protected function __construct(
32
        protected ?SAMLStringValue $NameQualifier = null,
33
        protected ?SAMLStringValue $SPNameQualifier = null,
34
    ) {
35
        Assert::nullOrNotWhitespaceOnly($NameQualifier);
36
        Assert::nullOrNotWhitespaceOnly($SPNameQualifier);
37
    }
38
39
40
    /**
41
     * Convert this BaseID to XML.
42
     */
43
    public function toXML(?DOMElement $parent = null): DOMElement
44
    {
45
        $e = $this->instantiateParentElement($parent);
46
47
        if ($this->getNameQualifier() !== null) {
48
            $e->setAttribute('NameQualifier', $this->getNameQualifier()->getValue());
49
        }
50
51
        if ($this->getSPNameQualifier() !== null) {
52
            $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue());
53
        }
54
55
        return $e;
56
    }
57
}
58