SeparatingNode   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A equals() 0 5 1
A __construct() 0 3 1
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\DaisyDiff\Html\Dom;
12
13
/**
14
 * This is an artificial text node whose sole purpose is to separate text nodes, so that they cannot be treated as a
15
 * continuous text flow by the RangeDifferencer.
16
 *
17
 * Such nodes will be created between two text nodes, when they really are separate, e.g. in two successive table cells.
18
 */
19
class SeparatingNode extends TextNode
20
{
21
    /**
22
     * @param TagNode|null $parent
23
     */
24 47
    public function __construct(?TagNode $parent)
25
    {
26 47
        parent::__construct($parent, '');
27 47
    }
28
29
    /**
30
     * @param Node|null $other
31
     * @return bool
32
     */
33 1
    public function equals(?Node $other): bool
34
    {
35
        // No other separator is equal to this one. This has the effect that text nodes separated by such a separator
36
        // can never be treated as a text sequence by the RangeDifferencer/TextNodeComparator.
37 1
        return $other === $this;
38
    }
39
}
40