PPID::fromXML()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\fed;
6
7
use DOMElement;
8
use SimpleSAML\WSSecurity\Assert\Assert;
9
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
10
use SimpleSAML\XMLSchema\Type\StringValue;
11
12
/**
13
 * A PPID element
14
 *
15
 * @package simplesamlphp/ws-security
16
 */
17
final class PPID extends AbstractAttributeExtensibleString
18
{
19
    /**
20
     * Create a class from XML
21
     *
22
     * @param \DOMElement $xml
23
     * @return static
24
     */
25
    public static function fromXML(DOMElement $xml): static
26
    {
27
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
28
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
29
30
        return new static(
31
            StringValue::fromString($xml->textContent),
32
            self::getAttributesNSFromXML($xml),
33
        );
34
    }
35
}
36