Passed
Pull Request — master (#64)
by Tim
02:05
created

AbstractECParametersType::getFieldID()   A

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
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\XML\dsig11;
6
7
use DOMElement;
8
9
/**
10
 * Abstract class representing a dsig11:ECParametersType
11
 *
12
 * @package simplesaml/xml-security
13
 */
14
abstract class AbstractECParametersType extends AbstractDsig11Element
15
{
16
    /**
17
     * Initialize a ECParametersType element.
18
     *
19
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\FieldID $fieldId
20
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\Curve $curve
21
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\Base $base
22
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\Order $order
23
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\CoFactor|null $coFactor
24
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\ValidationData|null $validationData
25
     */
26
    public function __construct(
27
        protected FieldID $fieldId,
28
        protected Curve $curve,
29
        protected Base $base,
30
        protected Order $order,
31
        protected ?CoFactor $coFactor = null,
32
        protected ?ValidationData $validationData = null,
33
    ) {
34
    }
35
36
37
    /**
38
     * Collect the value of the fieldId-property
39
     *
40
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\FieldID
41
     */
42
    public function getFieldID(): FieldID
43
    {
44
        return $this->fieldId;
45
    }
46
47
48
    /**
49
     * Collect the value of the curve-property
50
     *
51
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\Curve
52
     */
53
    public function getCurve(): Curve
54
    {
55
        return $this->curve;
56
    }
57
58
59
    /**
60
     * Collect the value of the base-property
61
     *
62
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\Base
63
     */
64
    public function getBase(): Base
65
    {
66
        return $this->base;
67
    }
68
69
70
    /**
71
     * Collect the value of the order-property
72
     *
73
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\Order
74
     */
75
    public function getOrder(): Order
76
    {
77
        return $this->order;
78
    }
79
80
81
    /**
82
     * Collect the value of the coFactor-property
83
     *
84
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\CoFactor|null
85
     */
86
    public function getCoFactor(): ?CoFactor
87
    {
88
        return $this->coFactor;
89
    }
90
91
92
    /**
93
     * Collect the value of the validationData-property
94
     *
95
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\ValidationData|null
96
     */
97
    public function getValidationData(): ?ValidationData
98
    {
99
        return $this->validationData;
100
    }
101
102
103
    /**
104
     * Convert this ECParametersType element to XML.
105
     *
106
     * @param \DOMElement|null $parent The element we should append this ECParametersType element to.
107
     * @return \DOMElement
108
     */
109
    public function toXML(?DOMElement $parent = null): DOMElement
110
    {
111
        $e = $this->instantiateParentElement($parent);
112
113
        $this->getFieldId()->toXML($e);
114
        $this->getCurve()->toXML($e);
115
        $this->getBase()->toXML($e);
116
        $this->getOrder()->toXML($e);
117
        $this->getCoFactor()?->toXML($e);
118
        $this->getValidationData()?->toXML($e);
119
120
        return $e;
121
    }
122
}
123