Completed
Push — master ( 7c66eb...e496eb )
by Edgar
06:39
created

DOMElementWrapper::isLoaded()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
namespace nstdio\svg\xml;
3
use DOMElement;
4
use nstdio\svg\traits\ElementTrait;
5
use nstdio\svg\XMLDocumentInterface;
6
7
/**
8
 * Class DOMElementWrapper
9
 *
10
 * @package nstdio\svg\xml
11
 * @author  Edgar Asatryan <[email protected]>
12
 */
13
class DOMElementWrapper implements XMLDocumentInterface
14
{
15
    use ElementTrait;
16
17
    /**
18
     * @var DOMElement
19
     */
20
    private $element;
21
22
23
    /**
24
     * DOMElementWrapper constructor.
25
     *
26
     * @param DOMElement $element
27
     */
28 121
    public function __construct(DOMElement $element)
29
    {
30 121
        $this->element = $element;
31 121
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36 121
    public function setAttribute($name, $value = null)
37
    {
38 121
        $this->element->setAttribute($name, $value);
39 121
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44 88
    public function getAttribute($name)
45
    {
46 88
        return $this->element->getAttribute($name);
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52 121
    public function setAttributeNS($namespaceURI, $qualifiedName, $value)
53
    {
54 121
        $this->element->setAttributeNS($namespaceURI, $qualifiedName, $value);
55 121
    }
56
57
    /**
58
     * @inheritdoc
59
     */
60 69
    public function getAttributeNS($namespaceURI, $localName)
61
    {
62 69
        return $this->element->getAttributeNS($namespaceURI, $localName);
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68 58
    public function appendChild(XMLDocumentInterface $newNode)
69
    {
70 58
        $this->element->appendChild($newNode->getElement());
71 58
    }
72
73
    /**
74
     * @inheritdoc
75
     */
76
    public function createElement($name, $value = null)
77
    {
78
79
    }
80
81
    /**
82
     * @inheritdoc
83
     */
84
    public function createElementNS($namespaceURI, $qualifiedName, $value = null)
85
    {
86
        throw NotImplementedException::newInstance();
87
    }
88
89
    /**
90
     * @inheritdoc
91
     */
92
    public function saveHTML()
93
    {
94
        // TODO: Implement saveHTML() method.
95
    }
96
97
    /**
98
     * @inheritdoc
99
     */
100
    public function saveXML($formatOutput)
101
    {
102
        // TODO: Implement saveXML() method.
103
    }
104
105
    /**
106
     * @inheritdoc
107
     */
108
    public static function isLoaded()
109
    {
110
        return DOMWrapper::isLoaded();
111
    }
112
113
    /**
114
     * @inheritdoc
115
     */
116 121
    public function getElement()
117
    {
118 121
        return $this->element;
119
    }
120
121
    /**
122
     * @inheritdoc
123
     */
124 1
    public function setNodeValue($value)
125
    {
126 1
        $this->element->nodeValue = $value;
127 1
    }
128
129
    /**
130
     * @inheritdoc
131
     */
132 1
    public function getNodeValue()
133
    {
134 1
        return $this->element->nodeValue;
135
    }
136
137
    /**
138
     * @inheritdoc
139
     */
140 1
    public function removeNode(XMLDocumentInterface $child)
141
    {
142 1
        return $this->element->removeChild($child->getElement());
143
    }
144
}