PnB   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromXML() 0 26 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
15
use function array_pop;
16
17
/**
18
 * Class representing a dsig11:PnB element.
19
 *
20
 * @package simplesaml/xml-security
21
 */
22
final class PnB extends AbstractPnBFieldParamsType implements SchemaValidatableElementInterface
23
{
24
    use SchemaValidatableElementTrait;
25
26
27
    /**
28
     * Convert XML into a PnB element
29
     *
30
     * @param \DOMElement $xml The XML element we should load
31
     *
32
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
33
     *   If the qualified name of the supplied element is wrong
34
     */
35
    public static function fromXML(DOMElement $xml): static
36
    {
37
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
38
        Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);
39
40
        $k1 = K1::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\dsig11\K1 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...
41
        Assert::minCount($k1, 1, MissingElementException::class);
42
        Assert::maxCount($k1, 1, TooManyElementsException::class);
43
44
        $k2 = K2::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\dsig11\K2 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...
45
        Assert::minCount($k2, 1, MissingElementException::class);
46
        Assert::maxCount($k2, 1, TooManyElementsException::class);
47
48
        $k3 = K3::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\dsig11\K3 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...
49
        Assert::minCount($k3, 1, MissingElementException::class);
50
        Assert::maxCount($k3, 1, TooManyElementsException::class);
51
52
        $m = M::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\dsig11\M 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...
53
        Assert::minCount($m, 1, MissingElementException::class);
54
        Assert::maxCount($m, 1, TooManyElementsException::class);
55
56
        return new static(
57
            array_pop($m),
58
            array_pop($k1),
59
            array_pop($k2),
60
            array_pop($k3),
61
        );
62
    }
63
}
64