Passed
Pull Request — master (#4)
by Tim
03:27 queued 01:27
created

AttributeDesignator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromXML() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML11\XML\saml;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10
11
/**
12
 * Class representing a saml:AttributeDesignator element.
13
 *
14
 * @package simplesamlphp/saml11
15
 */
16
final class AttributeDesignator extends AbstractAttributeDesignatorType
17
{
18
    /**
19
     * Convert XML into an AttributeDesignatorType
20
     *
21
     * @param \DOMElement $xml The XML element we should load
22
     * @return static
23
     *
24
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
25
     *   if the qualified name of the supplied element is wrong
26
     */
27
    public static function fromXML(DOMElement $xml): static
28
    {
29
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
30
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
31
32
        $AttributeName = self::getAttribute($xml, 'AttributeName');
33
        $AttributeNamespace = self::getAttribute($xml, 'AttributeNamespace');
34
35
        return new static($AttributeName, $AttributeNamespace);
36
    }
37
}
38