Issues (343)

src/XML/ElementInterface.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XML;
6
7
use DOMElement;
8
use SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface;
9
use SimpleSAML\XMLSchema\Type\StringValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\StringValue 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...
10
11
/**
12
 * interface class to be implemented by all the classes that represent an XML element
13
 *
14
 * @package simplesamlphp/xml-common
15
 */
16
interface ElementInterface
17
{
18
    /**
19
     * Get the XML qualified name (prefix:name) of the element represented by this class.
20
     */
21
    public function getQualifiedName(): string;
22
23
24
    /**
25
     * Get the value of an attribute from a given element.
26
     *
27
     * @param \DOMElement $xml The element where we should search for the attribute.
28
     * @param string      $name The name of the attribute.
29
     * @param string      $type The type of the attribute value
30
     * @return \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface
31
     *
32
     * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException if the attribute is missing from the element
33
     */
34
    public static function getAttribute(
35
        DOMElement $xml,
36
        string $name,
37
        string $type = StringValue::class,
38
    ): ValueTypeInterface;
39
40
41
    /**
42
     * Get the value of an attribute from a given element.
43
     *
44
     * @param \DOMElement $xml The element where we should search for the attribute.
45
     * @param string      $name The name of the attribute.
46
     * @param string      $type The type of the attribute value
47
     * @param \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface|null $default
48
     *   The default to return in case the attribute does not exist and it is optional.
49
     * @return \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface|null
50
     */
51
    public static function getOptionalAttribute(
52
        DOMElement $xml,
53
        string $name,
54
        string $type = StringValue::class,
55
        ?ValueTypeInterface $default = null,
56
    ): ?ValueTypeInterface;
57
}
58