Completed
Push — master ( da4b66...3ae217 )
by Tim
19s queued 15s
created

AbstractSubjectQueryAbstractType::toXML()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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