Issues (36)

src/CAS/XML/AbstractAuthenticationSuccess.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\CAS\XML;
6
7
use DOMElement;
8
9
/**
10
 * Class for CAS authenticationSuccess
11
 *
12
 * @package simplesamlphp/xml-cas
13
 */
14
abstract class AbstractAuthenticationSuccess extends AbstractResponse
15
{
16
    final public const string LOCALNAME = 'authenticationSuccess';
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 16 at column 30
Loading history...
17
18
19
    /**
20
     * Initialize a cas:authenticationSuccess element
21
     *
22
     * @param \SimpleSAML\CAS\XML\User $user
23
     * @param \SimpleSAML\CAS\XML\AbstractAttributes $attributes
24
     * @param \SimpleSAML\CAS\XML\ProxyGrantingTicket|null $proxyGrantingTicket
25
     * @param \SimpleSAML\CAS\XML\Proxies|null $proxies
26
     */
27
    public function __construct(
28
        protected User $user,
29
        protected AbstractAttributes $attributes,
30
        protected ?ProxyGrantingTicket $proxyGrantingTicket = null,
31
        protected ?Proxies $proxies = null,
32
    ) {
33
    }
34
35
36
    /**
37
     * @return \SimpleSAML\CAS\XML\User
38
     */
39
    public function getUser(): User
40
    {
41
        return $this->user;
42
    }
43
44
45
    /**
46
     * @return \SimpleSAML\CAS\XML\AbstractAttributes
47
     */
48
    public function getAttributes(): AbstractAttributes
49
    {
50
        return $this->attributes;
51
    }
52
53
54
    /**
55
     * @return \SimpleSAML\CAS\XML\ProxyGrantingTicket
56
     */
57
    public function getProxyGrantingTicket(): ?ProxyGrantingTicket
58
    {
59
        return $this->proxyGrantingTicket;
60
    }
61
62
63
    /**
64
     * @return \SimpleSAML\CAS\XML\Proxies
65
     */
66
    public function getProxies(): ?Proxies
67
    {
68
        return $this->proxies;
69
    }
70
71
72
    /**
73
     * Convert this AuthenticationSuccess to XML.
74
     *
75
     * @param \DOMElement|null $parent The element we should append this AuthenticationSuccess to.
76
     * @return \DOMElement
77
     */
78
    public function toXML(?DOMElement $parent = null): DOMElement
79
    {
80
        $e = $this->instantiateParentElement($parent);
81
82
        $this->getUser()->toXML($e);
83
        $this->getAttributes()->toXML($e);
84
        $this->getProxyGrantingTicket()?->toXML($e);
85
        $this->getProxies()?->toXML($e);
86
87
        return $e;
88
    }
89
}
90