DOMElement::hasChildNodes()   A
last analyzed

Complexity

Conditions 5
Paths 4

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4555
c 0
b 0
f 0
cc 5
nc 4
nop 0
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