Issues (341)

src/XMLSchema/XML/AbstractNumFacet.php (4 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSchema\XML;
6
7
use DOMElement;
8
use SimpleSAML\XML\Assert\Assert;
9
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
10
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
11
use SimpleSAML\XMLSchema\Type\BooleanValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\BooleanValue 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...
12
use SimpleSAML\XMLSchema\Type\IDValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\IDValue 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...
13
use SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface;
14
use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue 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...
15
16
/**
17
 * Abstract class representing the facet-type.
18
 *
19
 * @package simplesamlphp/xml-common
20
 */
21
abstract class AbstractNumFacet extends AbstractFacet
22
{
23
    /**
24
     * NumFacet constructor
25
     *
26
     * @param \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface $value
27
     * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $fixed
28
     * @param \SimpleSAML\XMLSchema\XML\Annotation|null $annotation
29
     * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id
30
     * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
31
     */
32
    final public function __construct(
33
        protected ValueTypeInterface $value,
34
        ?BooleanValue $fixed = null,
35
        ?Annotation $annotation = null,
0 ignored issues
show
The type SimpleSAML\XMLSchema\XML\Annotation 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...
36
        ?IDValue $id = null,
37
        array $namespacedAttributes = [],
38
    ) {
39
        Assert::isAOf($value, NonNegativeIntegerValue::class);
40
41
        parent::__construct($value, $fixed, $annotation, $id, $namespacedAttributes);
42
    }
43
44
45
    /**
46
     * Create an instance of this object from its XML representation.
47
     *
48
     * @param \DOMElement $xml
49
     * @return static
50
     *
51
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
52
     *   if the qualified name of the supplied element is wrong
53
     */
54
    public static function fromXML(DOMElement $xml): static
55
    {
56
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
57
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
58
59
        $annotation = Annotation::getChildrenOfClass($xml);
60
        Assert::maxCount($annotation, 1, TooManyElementsException::class);
61
62
        return new static(
63
            self::getAttribute($xml, 'value', NonNegativeIntegerValue::class),
64
            self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
65
            array_pop($annotation),
66
            self::getOptionalAttribute($xml, 'id', IDValue::class, null),
67
            self::getAttributesNSFromXML($xml),
68
        );
69
    }
70
}
71