DomElement   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 14 2
A __toString() 0 4 1
A attribute() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rs\XmlFilter\Document;
6
7
class DomElement extends \DOMElement implements Element
8
{
9 1
    public function find(string $path) : array
10
    {
11 1
        $xpath = new \DOMXpath($this->ownerDocument);
12
13 1
        $nodes = $xpath->query($path, $this);
14
15 1
        $result = [];
16
17 1
        foreach ($nodes as $node) {
18 1
            $result[] = $node;
19
        }
20
21 1
        return $result;
22
    }
23
24 1
    public function __toString()
25
    {
26 1
        return (string) $this->textContent;
27
    }
28
29 1
    public function attribute($name) : string
30
    {
31 1
        return $this->getAttribute($name);
32
    }
33
}
34