Passed
Push — master ( 4c710f...167df6 )
by Tim
14:01
created

AllowPostdating   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 29
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromXML() 0 6 1
A toXML() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\wst_200512;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10
11
/**
12
 * A AllowPostdating element
13
 *
14
 * @package simplesamlphp/ws-security
15
 */
16
final class AllowPostdating extends AbstractWstElement
17
{
18
    /**
19
     * Convert XML into a class instance
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
        return new static();
33
    }
34
35
36
    /**
37
     * Convert this element to XML.
38
     *
39
     * @param \DOMElement|null $parent The element we should append this element to.
40
     * @return \DOMElement
41
     */
42
    public function toXML(DOMElement $parent = null): DOMElement
43
    {
44
        return $this->instantiateParentElement($parent);
45
    }
46
}
47