Passed
Pull Request — master (#267)
by Tim
04:13 queued 01:48
created

Audience::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 1
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\saml;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10
11
/**
12
 * Class representing a saml:Audience element.
13
 *
14
 * @package simplesaml/saml2
15
 */
16
final class Audience extends AbstractConditionType
17
{
18
    /**
19
     * Convert XML into an Audience
20
     *
21
     * @param \DOMElement $xml The XML element we should load
22
     * @return self
23
     *
24
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
25
     *   If the qualified name of the supplied element is wrong
26
     */
27
    public static function fromXML(DOMElement $xml): object
28
    {
29
        Assert::same($xml->localName, 'Audience', InvalidDOMElementException::class);
30
        Assert::same($xml->namespaceURI, Audience::NS, InvalidDOMElementException::class);
31
32
        return new self($xml->textContent);
0 ignored issues
show
Unused Code introduced by
The call to SimpleSAML\SAML2\XML\saml\Audience::__construct() has too many arguments starting with $xml->textContent. ( Ignorable by Annotation )

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

32
        return /** @scrutinizer ignore-call */ new self($xml->textContent);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
33
    }
34
}
35
36