KeyInfo   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromXML() 0 30 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\XML\ds;
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\Type\IDValue;
13
use SimpleSAML\XMLSecurity\XML\dsig11\DEREncodedKeyValue;
14
15
use function array_merge;
16
17
/**
18
 * Class representing a ds:KeyInfo element.
19
 *
20
 * @package simplesamlphp/xml-security
21
 */
22
final class KeyInfo extends AbstractKeyInfoType implements SchemaValidatableElementInterface
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\ds\AbstractKeyInfoType 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...
23
{
24
    use SchemaValidatableElementTrait;
25
26
27
    /**
28
     * Convert XML into a KeyInfo
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, 'KeyInfo', InvalidDOMElementException::class);
38
        Assert::same($xml->namespaceURI, KeyInfo::NS, InvalidDOMElementException::class);
39
40
        $Id = self::getOptionalAttribute($xml, 'Id', IDValue::class, null);
41
42
        $keyName = KeyName::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\ds\KeyName 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...
43
        $keyValue = KeyValue::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\ds\KeyValue 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...
44
        $retrievalMethod = RetrievalMethod::getChildrenOfClass($xml);
45
        $x509Data = X509Data::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\ds\X509Data 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...
46
        $pgpData = PGPData::getChildrenOfClass($xml);
47
        $spkiData = SPKIData::getChildrenOfClass($xml);
48
        $mgmtData = MgmtData::getChildrenOfClass($xml);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\ds\MgmtData 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
        $derEncodedKeyValue = DEREncodedKeyValue::getChildrenOfClass($xml);
50
        $other = self::getChildElementsFromXML($xml);
51
52
        $info = array_merge(
53
            $keyName,
54
            $keyValue,
55
            $retrievalMethod,
56
            $x509Data,
57
            $pgpData,
58
            $spkiData,
59
            $mgmtData,
60
            $derEncodedKeyValue,
61
            $other,
62
        );
63
64
        return new static($info, $Id);
65
    }
66
}
67