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

LinkedRangeDifference   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setNext() 0 3 1
A __construct() 0 4 1
A isInsert() 0 3 1
A isDelete() 0 3 1
A getNext() 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\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