Passed
Push — master ( c19f8b...6f2b9b )
by Tim
02:42
created

Terminate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

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\SAML2\XML\samlp;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\XML\SchemaValidatableElementInterface;
10
use SimpleSAML\XML\SchemaValidatableElementTrait;
11
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12
13
/**
14
 * Class representing a samlp:Terminate element.
15
 *
16
 * @package simplesaml/saml2
17
 */
18
final class Terminate extends AbstractSamlpElement implements SchemaValidatableElementInterface
19
{
20
    use SchemaValidatableElementTrait;
21
22
23
    /**
24
     * Convert XML into a Terminate
25
     *
26
     * @param \DOMElement $xml The XML element we should load
27
     * @return static
28
     *
29
     * @throws \SimpleSAML\XMLSchema\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, 'Terminate', InvalidDOMElementException::class);
35
        Assert::same($xml->namespaceURI, Terminate::NS, InvalidDOMElementException::class);
36
37
        return new static();
38
    }
39
40
41
    /**
42
     * Convert this Terminate to XML.
43
     *
44
     * @param \DOMElement|null $parent The element we are converting to XML.
45
     * @return \DOMElement The XML element after adding the data corresponding to this Terminate.
46
     */
47
    public function toXML(?DOMElement $parent = null): DOMElement
48
    {
49
        return $this->instantiateParentElement($parent);
50
    }
51
}
52