AbstractECKeyValueType::getPublicKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\XML\dsig11;
6
7
use DOMElement;
8
use SimpleSAML\XML\Assert\Assert;
9
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
10
use SimpleSAML\XMLSchema\Type\IDValue;
0 ignored issues
show
Bug introduced by
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...
11
12
use function strval;
13
14
/**
15
 * Abstract class representing a dsig11:ECKeyValueType
16
 *
17
 * @package simplesaml/xml-security
18
 */
19
abstract class AbstractECKeyValueType extends AbstractDsig11Element
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\X...1\AbstractDsig11Element 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...
20
{
21
    /**
22
     * Initialize a FieldIDType element.
23
     *
24
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\PublicKey $publicKey
25
     * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id
26
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\ECParameters|null $ecParameters
27
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\NamedCurve|null $namedCurve
28
     */
29
    public function __construct(
30
        protected PublicKey $publicKey,
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSecurity\XML\dsig11\PublicKey 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...
31
        protected ?IDValue $id = null,
32
        protected ?ECParameters $ecParameters = null,
33
        protected ?NamedCurve $namedCurve = null,
34
    ) {
35
        Assert::oneOf(
36
            null,
37
            [$ecParameters, $namedCurve],
38
            'The ECParameters and NamedCurve are mutually exclusive; please specify one or the other.',
39
            SchemaViolationException::class,
40
        );
41
    }
42
43
44
    /**
45
     * Collect the value of the ecParameters-property
46
     *
47
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\ECParameters|null
48
     */
49
    public function getECParameters(): ?ECParameters
50
    {
51
        return $this->ecParameters;
52
    }
53
54
55
    /**
56
     * Collect the value of the namedCurve-property
57
     *
58
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\NamedCurve|null
59
     */
60
    public function getNamedCurve(): ?NamedCurve
61
    {
62
        return $this->namedCurve;
63
    }
64
65
66
    /**
67
     * Collect the value of the publicKey-property
68
     *
69
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\PublicKey
70
     */
71
    public function getPublicKey(): PublicKey
72
    {
73
        return $this->publicKey;
74
    }
75
76
77
    /**
78
     * Collect the value of the id-property
79
     *
80
     * @return \SimpleSAML\XMLSchema\Type\IDValue|null
81
     */
82
    public function getId(): ?IDValue
83
    {
84
        return $this->id;
85
    }
86
87
88
    /**
89
     * Convert this ECKeyValueType element to XML.
90
     *
91
     * @param \DOMElement|null $parent The element we should append this ECKeyValueType element to.
92
     */
93
    public function toXML(?DOMElement $parent = null): DOMElement
94
    {
95
        $e = $this->instantiateParentElement($parent);
96
97
        if ($this->getId() !== null) {
98
            $e->setAttribute('Id', strval($this->getId()));
99
        }
100
101
        $this->getECParameters()?->toXML($e);
102
        $this->getNamedCurve()?->toXML($e);
103
        $this->getPublicKey()->toXML($e);
104
105
        return $e;
106
    }
107
}
108