RemoveNodeVisitor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 3
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A leaveNode() 0 2 1
A enterNode() 0 4 2
1
<?php
2
/**
3
 * (c) Steve Nebes <[email protected]>.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
declare(strict_types=1);
10
11
namespace SN\HtmlSanitizer\NodeVisitor;
12
13
use DOMNode;
14
use SN\HtmlSanitizer\Model\Cursor;
15
16
class RemoveNodeVisitor extends TagNodeVisitor
17
{
18
    /**
19
     * @param DOMNode $domNode
20
     * @param Cursor  $cursor
21
     */
22 1
    public function enterNode(DOMNode $domNode, Cursor $cursor)
23
    {
24 1
        while ($domNode->hasChildNodes()) {
25 1
            $domNode->removeChild($domNode->childNodes[0]);
26
        }
27 1
    }
28
29
    /**
30
     * @param DOMNode $domNode
31
     * @param Cursor  $cursor
32
     */
33 1
    public function leaveNode(DOMNode $domNode, Cursor $cursor)
34
    {
35 1
    }
36
}
37