Passed
Push — master ( 152b2f...310ac7 )
by Tim
02:10
created

OneTimeUse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toXML() 0 3 1
A fromXML() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\saml;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10
use SimpleSAML\XML\Exception\SchemaViolationException;
11
12
/**
13
 * Class representing a saml:OneTimeUse element.
14
 *
15
 * @package simplesaml/saml2
16
 */
17
final class OneTimeUse extends AbstractConditionType
18
{
19
    /**
20
     * Convert XML into an OneTimeUse
21
     *
22
     * @param \DOMElement $xml The XML element we should load
23
     * @return static
24
     *
25
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
26
     *   If the qualified name of the supplied element is wrong
27
     */
28
    public static function fromXML(DOMElement $xml): static
29
    {
30
        Assert::same($xml->localName, 'OneTimeUse', InvalidDOMElementException::class);
31
        Assert::same($xml->namespaceURI, OneTimeUse::NS, InvalidDOMElementException::class);
32
33
        return new static();
34
    }
35
36
37
    /**
38
     * Convert this OneTimeUse to XML.
39
     *
40
     * @param \DOMElement $parent The element we are converting to XML.
41
     * @return \DOMElement The XML element after adding the data corresponding to this OneTimeUse.
42
     */
43
    public function toXML(DOMElement $parent = null): DOMElement
44
    {
45
        return $this->instantiateParentElement($parent);
46
    }
47
}
48