Passed
Pull Request — master (#64)
by Tim
02:03
created

Prime   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromXML() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\XML\dsig11;
6
7
use SimpleSAML\Assert\Assert;
8
use SimpleSAML\XML\Exception\InvalidDOMElementException;
9
use SimpleSAML\XML\SchemaValidatableElementInterface;
10
use SimpleSAML\XML\SchemaValidatableElementTrait;
11
12
/**
13
 * Class representing a dsig11:Prime element.
14
 *
15
 * @package simplesaml/xml-security
16
 */
17
final class Prime extends AbstractPrimeFieldParamsType implements SchemaValidatableElementInterface
18
{
19
    use SchemaValidatableElementTrait;
0 ignored issues
show
introduced by
The trait SimpleSAML\XML\SchemaValidatableElementTrait requires some properties which are not provided by SimpleSAML\XMLSecurity\XML\dsig11\Prime: $message, $line
Loading history...
20
21
    /**
22
     * Convert XML into a Prime element
23
     *
24
     * @param \DOMElement $xml The XML element we should load
25
     * @return static
26
     *
27
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
28
     *   If the qualified name of the supplied element is wrong
29
     */
30
    public static function fromXML(DOMElement $xml): static
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\dsig11\DOMElement was not found. Did you mean DOMElement? If so, make sure to prefix the type with \.
Loading history...
31
    {
32
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
33
        Assert::same($xml->namespaceURI, static::getNamespaceURI(), InvalidDOMElementException::class);
34
35
        return new static(
36
            P::getChildrenOfClass($xml),
0 ignored issues
show
Bug introduced by
SimpleSAML\XMLSecurity\X...etChildrenOfClass($xml) of type array|array<mixed,Simple...LSecurity\XML\dsig11\P> is incompatible with the type SimpleSAML\XMLSecurity\XML\dsig11\P expected by parameter $p of SimpleSAML\XMLSecurity\X...11\Prime::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
            /** @scrutinizer ignore-type */ P::getChildrenOfClass($xml),
Loading history...
37
        );
38
    }
39
}
40