simplesamlphp /
xml-cas
| 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 proxyFailure |
||
| 14 | * |
||
| 15 | * @package simplesamlphp/xml-cas |
||
| 16 | */ |
||
| 17 | abstract class AbstractProxyFailure extends AbstractResponse |
||
| 18 | { |
||
| 19 | use TypedTextContentTrait; |
||
| 20 | |||
| 21 | |||
| 22 | public const string TEXTCONTENT_TYPE = StringValue::class; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 23 | |||
| 24 | final public const string LOCALNAME = 'proxyFailure'; |
||
| 25 | |||
| 26 | |||
| 27 | /** |
||
| 28 | * Create a new instance of ProxyFailure |
||
| 29 | * |
||
| 30 | * @param \SimpleSAML\XMLSchema\Type\StringValue $content |
||
| 31 | * @param \SimpleSAML\CAS\Type\CodeValue $code |
||
| 32 | */ |
||
| 33 | final 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 ProxyFailure to XML. |
||
| 54 | * |
||
| 55 | * @param \DOMElement|null $parent The element we should append to. |
||
| 56 | * @return \DOMElement This ProxyFailure-element. |
||
| 57 | */ |
||
| 58 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 59 | { |
||
| 60 | $e = $this->instantiateParentElement($parent); |
||
| 61 | |||
| 62 | $e->textContent = $this->getContent()->getValue(); |
||
| 63 | $e->setAttribute('code', $this->getCode()->getValue()); |
||
| 64 | |||
| 65 | return $e; |
||
| 66 | } |
||
| 67 | } |
||
| 68 |