SubjectConfirmationData   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 28
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromXML() 0 13 1
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\EntityIDValue;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\Type\EntityIDValue 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...
10
use SimpleSAML\SAML2\Type\SAMLDateTimeValue;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\Type\SAMLDateTimeValue 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...
11
use SimpleSAML\SAML2\Type\SAMLStringValue;
12
use SimpleSAML\XML\SchemaValidatableElementInterface;
13
use SimpleSAML\XML\SchemaValidatableElementTrait;
14
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
15
use SimpleSAML\XMLSchema\Type\NCNameValue;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSchema\Type\NCNameValue 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...
16
17
/**
18
 * Class representing SAML 2 SubjectConfirmationData element.
19
 *
20
 * @package simplesamlphp/saml2
21
 */
22
final class SubjectConfirmationData extends AbstractSubjectConfirmationData implements SchemaValidatableElementInterface
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\sam...SubjectConfirmationData 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...
23
{
24
    use SchemaValidatableElementTrait;
25
26
27
    /**
28
     * Convert XML into a SubjectConfirmationData
29
     *
30
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
31
     *   if the qualified name of the supplied element is wrong
32
     * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
33
     *   if the supplied element is missing any of the mandatory attributes
34
     * @throws \SimpleSAML\Assert\AssertionFailedException
35
     *   if NotBefore or NotOnOrAfter contain an invalid date.
36
     */
37
    public static function fromXML(DOMElement $xml): static
38
    {
39
        Assert::same($xml->localName, 'SubjectConfirmationData', InvalidDOMElementException::class);
40
        Assert::same($xml->namespaceURI, SubjectConfirmationData::NS, InvalidDOMElementException::class);
41
42
        return new static(
43
            self::getOptionalAttribute($xml, 'NotBefore', SAMLDateTimeValue::class, null),
44
            self::getOptionalAttribute($xml, 'NotOnOrAfter', SAMLDateTimeValue::class, null),
45
            self::getOptionalAttribute($xml, 'Recipient', EntityIDValue::class, null),
46
            self::getOptionalAttribute($xml, 'InResponseTo', NCNameValue::class, null),
47
            self::getOptionalAttribute($xml, 'Address', SAMLStringValue::class, null),
48
            self::getChildElementsFromXML($xml),
49
            self::getAttributesNSFromXML($xml),
50
        );
51
    }
52
}
53