OneTimeUse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 32
rs 10
c 0
b 0
f 0
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\SchemaValidatableElementInterface;
11
use SimpleSAML\XML\SchemaValidatableElementTrait;
12
13
/**
14
 * Class representing a saml:OneTimeUse element.
15
 *
16
 * @package simplesaml/saml2
17
 */
18
final class OneTimeUse extends AbstractConditionType implements SchemaValidatableElementInterface
19
{
20
    use SchemaValidatableElementTrait;
21
22
23
    /**
24
     * Convert XML into an OneTimeUse
25
     *
26
     * @param \DOMElement $xml The XML element we should load
27
     * @return static
28
     *
29
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
30
     *   If the qualified name of the supplied element is wrong
31
     */
32
    public static function fromXML(DOMElement $xml): static
33
    {
34
        Assert::same($xml->localName, 'OneTimeUse', InvalidDOMElementException::class);
35
        Assert::same($xml->namespaceURI, OneTimeUse::NS, InvalidDOMElementException::class);
36
37
        return new static();
38
    }
39
40
41
    /**
42
     * Convert this OneTimeUse to XML.
43
     *
44
     * @param \DOMElement $parent The element we are converting to XML.
45
     * @return \DOMElement The XML element after adding the data corresponding to this OneTimeUse.
46
     */
47
    public function toXML(?DOMElement $parent = null): DOMElement
48
    {
49
        return $this->instantiateParentElement($parent);
50
    }
51
}
52