ValidationData   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromXML() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\XML\dsig11;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\SchemaValidatableElementInterface;
10
use SimpleSAML\XML\SchemaValidatableElementTrait;
11
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
12
use SimpleSAML\XMLSchema\Exception\MissingElementException;
13
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
14
use SimpleSAML\XMLSchema\Type\AnyURIValue;
15
16
use function array_pop;
17
18
/**
19
 * Class representing a dsig11:ValidationData element.
20
 *
21
 * @package simplesaml/xml-security
22
 */
23
final class ValidationData extends AbstractECValidationDataType implements SchemaValidatableElementInterface
24
{
25
    use SchemaValidatableElementTrait;
26
27
28
    /**
29
     * Convert XML into a ValidationData element
30
     *
31
     * @param \DOMElement $xml The XML element we should load
32
     *
33
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
34
     *   If the qualified name of the supplied element is wrong
35
     */
36
    public static function fromXML(DOMElement $xml): static
37
    {
38
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
39
        Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);
40
41
        $seed = Seed::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\dsig11\Seed was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
        Assert::minCount($seed, 1, MissingElementException::class);
43
        Assert::maxCount($seed, 1, TooManyElementsException::class);
44
45
        return new static(
46
            array_pop($seed),
47
            self::getAttribute($xml, 'hashAlgorithm', AnyURIValue::class),
48
        );
49
    }
50
}
51