Issues (36)

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

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\CAS\XML;
6
7
use DOMElement;
8
use SimpleSAML\CAS\Type\CodeValue;
9
use SimpleSAML\XML\TypedTextContentTrait;
10
use SimpleSAML\XMLSchema\Type\StringValue;
11
12
/**
13
 * Class for CAS authenticationFailure
14
 *
15
 * @package simplesamlphp/xml-cas
16
 */
17
abstract class AbstractAuthenticationFailure extends AbstractResponse
18
{
19
    use TypedTextContentTrait;
20
21
22
    public const string TEXTCONTENT_TYPE = StringValue::class;
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 22 at column 24
Loading history...
23
24
    final public const string LOCALNAME = 'authenticationFailure';
25
26
27
    /**
28
     * Create a new instance of AuthenticationFailure
29
     *
30
     * @param \SimpleSAML\XMLSchema\Type\StringValue $content
31
     * @param \SimpleSAML\CAS\Type\CodeValue $code
32
     */
33
    public function __construct(
34
        StringValue $content,
35
        protected CodeValue $code,
36
    ) {
37
        $this->setContent($content);
38
    }
39
40
41
    /**
42
     * Collect the value of the code-property
43
     *
44
     * @return \SimpleSAML\CAS\Type\CodeValue
45
     */
46
    public function getCode(): CodeValue
47
    {
48
        return $this->code;
49
    }
50
51
52
    /**
53
     * Convert this AuthenticationFailure to XML.
54
     *
55
     * @param \DOMElement|null $parent The element we should append to.
56
     * @return \DOMElement This AuthenticatioFailure-element.
57
     */
58
    public function toXML(?DOMElement $parent = null): DOMElement
59
    {
60
        $e = $this->instantiateParentElement($parent);
61
62
        $e->setAttribute('code', $this->getCode()->getValue());
63
        $e->textContent = $this->getContent()->getValue();
64
65
        return $e;
66
    }
67
}
68