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

AbstractSubjectQueryAbstractType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getSubject() 0 3 1
A toXML() 0 7 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