AbstractAnonymousType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toXML() 0 6 1
A getValue() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\wsaw;
6
7
use DOMElement;
8
9
/**
10
 * Abstract class defining the Anonymous type
11
 *
12
 * @package simplesamlphp/ws-security
13
 */
14
abstract class AbstractAnonymousType extends AbstractWsawElement
15
{
16
    /**
17
     * AbstractAnonymousType constructor
18
     *
19
     * @param \SimpleSAML\WSSecurity\XML\wsaw\AnonymousEnum $value
20
     */
21
    public function __construct(
22
        protected AnonymousEnum $value,
23
    ) {
24
    }
25
26
27
    /**
28
     * @return \SimpleSAML\WSSecurity\XML\wsaw\AnonymousEnum
29
     */
30
    public function getValue(): AnonymousEnum
31
    {
32
        return $this->value;
33
    }
34
35
36
    /**
37
     * Convert this Anomymous to XML.
38
     *
39
     * @param \DOMElement|null $parent The element we should append this class to.
40
     * @return \DOMElement The XML element after adding the data corresponding to this Anonymous.
41
     */
42
    public function toXML(?DOMElement $parent = null): DOMElement
43
    {
44
        $e = $this->instantiateParentElement($parent);
45
        $e->textContent = $this->getValue()->value;
46
47
        return $e;
48
    }
49
}
50