Issues (341)

src/XMLSchema/XML/AbstractAnnotated.php (3 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSchema\XML;
6
7
use DOMElement;
8
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...
9
10
use function strval;
11
12
/**
13
 * Abstract class representing the annotated-type.
14
 *
15
 * @package simplesamlphp/xml-common
16
 */
17
abstract class AbstractAnnotated extends AbstractOpenAttrs
0 ignored issues
show
The type SimpleSAML\XMLSchema\XML\AbstractOpenAttrs 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...
18
{
19
    /**
20
     * Annotated constructor
21
     *
22
     * @param \SimpleSAML\XMLSchema\XML\Annotation|null $annotation
23
     * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id
24
     * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
25
     */
26
    public function __construct(
27
        protected ?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...
28
        protected ?IDValue $id = null,
29
        array $namespacedAttributes = [],
30
    ) {
31
        parent::__construct($namespacedAttributes);
32
    }
33
34
35
    /**
36
     * Collect the value of the annotation-property
37
     *
38
     * @return \SimpleSAML\XMLSchema\XML\Annotation|null
39
     */
40
    public function getAnnotation(): ?Annotation
41
    {
42
        return $this->annotation;
43
    }
44
45
46
    /**
47
     * Collect the value of the id-property
48
     *
49
     * @return \SimpleSAML\XMLSchema\Type\IDValue|null
50
     */
51
    public function getId(): ?IDValue
52
    {
53
        return $this->id;
54
    }
55
56
57
    /**
58
     * Test if an object, at the state it's in, would produce an empty XML-element
59
     *
60
     * @return bool
61
     */
62
    public function isEmptyElement(): bool
63
    {
64
        return parent::isEmptyElement() &&
65
            empty($this->getAnnotation()) &&
66
            empty($this->getId());
67
    }
68
69
70
    /**
71
     * Add this Annotated to an XML element.
72
     *
73
     * @param \DOMElement|null $parent The element we should append this Annotated to.
74
     * @return \DOMElement
75
     */
76
    public function toXML(?DOMElement $parent = null): DOMElement
77
    {
78
        $e = parent::toXML($parent);
79
80
        if ($this->getId() !== null) {
81
            $e->setAttribute('id', strval($this->getId()));
82
        }
83
84
        $this->getAnnotation()?->toXML($e);
85
86
        return $e;
87
    }
88
}
89