EidasSPType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A toXML() 0 8 1
1
<?php
2
3
namespace OMSAML2\Chunks;
4
5
use DOMElement;
6
use SAML2\XML\Chunk;
7
8
class EidasSPType extends Chunk
9
{
10
    const NS_EIDAS = 'http://eidas.europa.eu/saml-extensions';
11
    const LOCAL_NAME = 'SPType';
12
    const QUALIFIED_NAME = 'eidas:' . self::LOCAL_NAME;
13
    public $sptype = 'public';
14
15
    public function __construct(?DOMElement $xml = null)
16
    {
17
        if (!empty($xml)) {
18
            parent::__construct($xml);
19
            $this->sptype = $xml->nodeValue;
20
        }
21
    }
22
23
    public function toXML(DOMElement $parent): DOMElement
24
    {
25
        $sptype = $parent->ownerDocument->createElementNS(self::NS_EIDAS, self::QUALIFIED_NAME);
26
        $sptype->nodeValue = $this->sptype;
27
28
        $parent->appendChild($sptype);
29
30
        return $sptype;
31
    }
32
}