AbstractSubjectStatementType::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML11\XML\saml;
6
7
use DOMElement;
8
9
/**
10
 * @package simplesamlphp\saml11
11
 */
12
abstract class AbstractSubjectStatementType extends AbstractStatementType
13
{
14
    /**
15
     * CustomStatement constructor.
16
     *
17
     * @param \SimpleSAML\SAML11\XML\saml\Subject $subject
18
     */
19
    public function __construct(
20
        protected Subject $subject,
21
    ) {
22
    }
23
24
25
    /**
26
     * Get the value of the subject-attribute.
27
     *
28
     * @return \SimpleSAML\SAML11\XML\saml\Subject
29
     */
30
    public function getSubject(): Subject
31
    {
32
        return $this->subject;
33
    }
34
35
36
    /**
37
     * Convert this SubjectStatement to XML.
38
     *
39
     * @param \DOMElement $parent The element we are converting to XML.
40
     * @return \DOMElement The XML element after adding the data corresponding to this SubjectStatement.
41
     */
42
    public function toXML(?DOMElement $parent = null): DOMElement
43
    {
44
        $e = $this->instantiateParentElement($parent);
45
46
        $this->getSubject()->toXML($e);
47
48
        return $e;
49
    }
50
}
51