Passed
Push — master ( 0d07bf...dd4616 )
by Steve
35s
created

LastCommonParentResult   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 79
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getIndexInLastCommonParent() 0 3 1
A setSplittingNeeded() 0 3 1
A getLastCommonParentDepth() 0 3 1
A getLastCommonParent() 0 3 1
A setLastCommonParentDepth() 0 3 1
A setLastCommonParent() 0 3 1
A setIndexInLastCommonParent() 0 3 1
A isSplittingNeeded() 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\Helper;
12
13
use SN\DaisyDiff\Html\Dom\TagNode;
14
15
/**
16
 * When detecting the last common parent of two nodes, all results are stored as a LastCommonParentResult.
17
 */
18
class LastCommonParentResult
19
{
20
    /** @var TagNode */
21
    private $parent;
22
23
    /** @var bool */
24
    private $splittingNeeded = false;
25
26
    /** @var int */
27
    private $lastCommonParentDepth = -1;
28
29
    /** @var int */
30
    private $indexInLastCommonParent = -1;
31
32
    /**
33
     * @return TagNode|null
34
     */
35 10
    public function getLastCommonParent(): ?TagNode
36
    {
37 10
        return $this->parent;
38
    }
39
40
    /**
41
     * @param TagNode $value
42
     * @return void
43
     */
44 10
    public function setLastCommonParent(?TagNode $value): void
45
    {
46 10
        $this->parent = $value;
47 10
    }
48
49
    /**
50
     * @return bool
51
     */
52 9
    public function isSplittingNeeded(): bool
53
    {
54 9
        return $this->splittingNeeded;
55
    }
56
57
    /**
58
     * @return void
59
     */
60 5
    public function setSplittingNeeded(): void
61
    {
62 5
        $this->splittingNeeded = true;
63 5
    }
64
65
    /**
66
     * @return int
67
     */
68 10
    public function getLastCommonParentDepth(): int
69
    {
70 10
        return $this->lastCommonParentDepth;
71
    }
72
73
    /**
74
     * @param int $value
75
     * @return void
76
     */
77 10
    public function setLastCommonParentDepth(int $value): void
78
    {
79 10
        $this->lastCommonParentDepth = $value;
80 10
    }
81
82
    /**
83
     * @return int
84
     */
85 10
    public function getIndexInLastCommonParent(): int
86
    {
87 10
        return $this->indexInLastCommonParent;
88
    }
89
90
    /**
91
     * @param int $value
92
     * @return void
93
     */
94 10
    public function setIndexInLastCommonParent(int $value): void
95
    {
96 10
        $this->indexInLastCommonParent = $value;
97 10
    }
98
}
99