MGF::fromXML()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\XML\xenc11;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
10
use SimpleSAML\XMLSchema\Type\AnyURIValue;
11
12
/**
13
 * A class implementing the xenc11:MGF element.
14
 *
15
 * @package simplesamlphp/xml-security
16
 */
17
final class MGF extends AbstractMGFType
18
{
19
    /**
20
     * @inheritDoc
21
     *
22
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
23
     *   If the qualified name of the supplied element is wrong
24
     */
25
    public static function fromXML(DOMElement $xml): static
26
    {
27
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
28
        Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);
29
30
        return new static(
31
            self::getAttribute($xml, 'Algorithm', AnyURIValue::class),
32
        );
33
    }
34
}
35