DOMElement   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hasChildNodes() 0 15 5
1
<?php
2
3
/**
4
 * This file is part of the php-epp2 library.
5
 *
6
 * (c) Gunter Grodotzki <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE file
9
 * that was distributed with this source code.
10
 */
11
12
namespace AfriCC\EPP\DOM;
13
14
use DOMElement as PHP_DOMElement;
15
use DOMNodeList;
16
17
class DOMElement extends PHP_DOMElement
18
{
19
    public function hasChildNodes()
20
    {
21
        $children = $this->childNodes;
22
        if (!($children instanceof DOMNodeList) || $children->length === 0) {
23
            return false;
24
        }
25
26
        foreach ($children as $child) {
27
            if ($child->nodeType === XML_ELEMENT_NODE) {
28
                return true;
29
            }
30
        }
31
32
        return false;
33
    }
34
}
35