AbstractSubjectQuery::getSubject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\samlp;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
10
use SimpleSAML\SAML2\Type\SAMLDateTimeValue;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\Type\SAMLDateTimeValue was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use SimpleSAML\SAML2\XML\saml\Issuer;
12
use SimpleSAML\SAML2\XML\saml\Subject;
13
use SimpleSAML\XMLSchema\Type\IDValue;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSchema\Type\IDValue was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
/**
16
 * Base class for SAML 2 subject query messages.
17
 *
18
 * This base class can be used for various requests which ask for
19
 * information about a particular subject.
20
 *
21
 * Note that this class currently only handles the simple case - where the
22
 * subject doesn't contain any sort of subject confirmation requirements.
23
 *
24
 * @package simplesamlphp/saml2
25
 */
26
abstract class AbstractSubjectQuery extends AbstractRequest
27
{
28
    /**
29
     * Constructor for SAML 2 response messages.
30
     *
31
     * @param \SimpleSAML\XMLSchema\Type\IDValue $id
32
     * @param \SimpleSAML\SAML2\XML\saml\Subject $subject
33
     * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer
34
     * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant
35
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination
36
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent
37
     * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions
38
     */
39
    protected function __construct(
40
        IDValue $id,
41
        protected Subject $subject,
42
        ?Issuer $issuer = null,
43
        ?SAMLDateTimeValue $issueInstant = null,
44
        ?SAMLAnyURIValue $destination = null,
45
        ?SAMLAnyURIValue $consent = null,
46
        ?Extensions $extensions = null,
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\samlp\Extensions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
47
    ) {
48
        parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions);
49
    }
50
51
52
    /**
53
     * Collect the value of the subject
54
     *
55
     * @return \SimpleSAML\SAML2\XML\saml\Subject
56
     */
57
    public function getSubject(): Subject
58
    {
59
        return $this->subject;
60
    }
61
62
63
    /**
64
     * Convert this message to an unsigned XML document.
65
     * This method does not sign the resulting XML document.
66
     */
67
    protected function toUnsignedXML(?DOMElement $parent = null): DOMElement
68
    {
69
        Assert::notEmpty($this->subject, 'Cannot convert SubjectQuery to XML without a Subject set.');
70
71
        $parent = parent::toUnsignedXML($parent);
72
73
        $this->getSubject()->toXML($parent);
74
75
        return $parent;
76
    }
77
}
78