Completed
Push — master ( dc7b5d...c3368a )
by Tim
35s queued 15s
created

Input   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 0
f 0
dl 0
loc 24
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\WSSecurity\XML\wsdl;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10
11
/**
12
 * Class representing the input-element.
13
 *
14
 * @package simplesamlphp/ws-security
15
 */
16
final class Input extends AbstractParam
17
{
18
    /** @var string */
19
    final public const LOCALNAME = 'input';
20
21
22
    /**
23
     * Initialize a input-element.
24
     *
25
     * @param \DOMElement $xml The XML element we should load.
26
     * @return static
27
     *
28
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
29
     *   if the qualified name of the supplied element is wrong
30
     */
31
    public static function fromXML(DOMElement $xml): static
32
    {
33
        Assert::same($xml->localName, static::LOCALNAME, InvalidDOMElementException::class);
34
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
35
36
        return new static(
37
            self::getAttribute($xml, 'message'),
38
            self::getOptionalAttribute($xml, 'name'),
39
            self::getAttributesNSFromXML($xml),
40
        );
41
    }
42
}
43