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

LinkedRangeDifference::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\RangeDifferencer;
12
13
/**
14
 * Singly Linked RangeDifference
15
 */
16
class LinkedRangeDifference extends RangeDifference
17
{
18
    /** @const int */
19
    const INSERT = 0;
20
    const DELETE = 1;
21
22
    /** @var LinkedRangeDifference|null */
23
    private $next;
24
25
    /**
26
     * @param LinkedRangeDifference|null $next
27
     * @param int                        $operation
28
     */
29 31
    public function __construct(?LinkedRangeDifference $next = null, int $operation = RangeDifference::ERROR)
30
    {
31 31
        parent::__construct($operation);
32 31
        $this->next = $next;
33 31
    }
34
35
    /**
36
     * @return LinkedRangeDifference|null
37
     */
38 31
    public function getNext(): ?LinkedRangeDifference
39
    {
40 31
        return $this->next;
41
    }
42
43
    /**
44
     * @param LinkedRangeDifference|null $next
45
     */
46 31
    public function setNext(?LinkedRangeDifference $next): void
47
    {
48 31
        $this->next = $next;
49 31
    }
50
51
    /**
52
     * @return bool
53
     */
54 24
    public function isDelete(): bool
55
    {
56 24
        return $this->getKind() === self::DELETE;
57
    }
58
59
    /**
60
     * @return bool
61
     */
62 31
    public function isInsert(): bool
63
    {
64 31
        return $this->getKind() === self::INSERT;
65
    }
66
}
67