Passed
Push — master ( 0aff4f...e61fad )
by Tim
02:24
created

RequesterID   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

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