Passed
Pull Request — master (#267)
by Tim
02:40
created

Audience::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 1
f 0
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
11
/**
12
 * Class representing a saml:Audience element.
13
 *
14
 * @package simplesaml/saml2
15
 */
16
final class Audience extends AbstractConditionType
17
{
18
    /**
19
     * Convert XML into an Audience
20
     *
21
     * @param \DOMElement $xml The XML element we should load
22
     * @return self
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): object
28
    {
29
        Assert::same($xml->localName, 'Audience', InvalidDOMElementException::class);
30
        Assert::same($xml->namespaceURI, Audience::NS, InvalidDOMElementException::class);
31
32
        return new self($xml->textContent);
33
    }
34
}
35
36