Passed
Pull Request — master (#64)
by Tim
01:58
created

AbstractFieldIDType::getTnB()   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
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\ExtendableElementTrait;
9
use SimpleSAML\XML\XsNamespace as NS;
10
11
/**
12
 * Abstract class representing a dsig11:FieldIDType
13
 *
14
 * @package simplesaml/xml-security
15
 */
16
abstract class AbstractFieldIDType extends AbstractDsig11Element
17
{
18
    use ExtendableElementTrait;
19
20
    /** @var \SimpleSAML\XML\XsNamespace */
21
    public const XS_ANY_ELT_NAMESPACE = NS::OTHER;
22
23
24
    /**
25
     * Initialize a FieldIDType element.
26
     *
27
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\Prime $prime
28
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\TnB $tnb
29
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\PnB $pnb
30
     * @param \SimpleSAML\XMLSecurity\XML\dsig11\GnB $gnb
31
     * @param array<\SimpleSAML\XML\SerializableElementInterface> $children
32
     */
33
    public function __construct(
34
        protected Prime $p,
35
        protected TnB $tnb,
36
        protected PnB $pnb,
37
        protected GnB $gnb,
38
        array $children,
39
    ) {
40
        $this->setElements($children);
41
    }
42
43
44
    /**
45
     * Collect the value of the prime-property
46
     *
47
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\Prime
48
     */
49
    public function getPrime(): Prime
50
    {
51
        return $this->prime;
0 ignored issues
show
Bug Best Practice introduced by
The property prime does not exist on SimpleSAML\XMLSecurity\X...g11\AbstractFieldIDType. Did you maybe forget to declare it?
Loading history...
52
    }
53
54
55
    /**
56
     * Collect the value of the tnb-property
57
     *
58
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\TnB
59
     */
60
    public function getTnB(): TnB
61
    {
62
        return $this->tnb;
63
    }
64
65
66
    /**
67
     * Collect the value of the pnb-property
68
     *
69
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\PnB
70
     */
71
    public function getPnB(): PnB
72
    {
73
        return $this->pnb;
74
    }
75
76
77
    /**
78
     * Collect the value of the gnb-property
79
     *
80
     * @return \SimpleSAML\XMLSecurity\XML\dsig11\GnB
81
     */
82
    public function getGnB(): GnB
83
    {
84
        return $this->gnb;
85
    }
86
87
88
    /**
89
     * Convert this FieldIDType element to XML.
90
     *
91
     * @param \DOMElement|null $parent The element we should append this FieldIDType element to.
92
     * @return \DOMElement
93
     */
94
    public function toXML(?DOMElement $parent = null): DOMElement
95
    {
96
        $e = parent::toXML($parent);
97
98
        $this->getPrime()->toXML($e);
99
        $this->getTnB()->toXML($e);
100
        $this->getPnB()->toXML($e);
101
        $this->getGnB()->toXML($e);
102
103
        foreach ($this->getElements() as $elt) {
104
            $elt->toXML($e);
105
        }
106
107
        return $e;
108
    }
109
}
110