DiffFileState::incrementCurrentPosition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker;
3
4
class DiffFileState
5
{
6
    private $currentPosition = 0;
7
    private $currentFile;
8
    private $changeLines = [];
9
    
10
    public function setCurrentPosition(int $position)
11
    {
12
        $this->currentPosition = $position;
13
    }
14
15
    public function setCurrentFile(string $currentFile)
16
    {
17
        $this->currentFile = $currentFile;
18
    }
19
20
    public function addChangeLine()
21
    {
22
        if (!isset($this->changeLines[$this->currentFile])) {
23
            $this->changeLines[$this->currentFile] = [];
24
        }
25
        $this->changeLines[$this->currentFile][] = $this->currentPosition;
26
    }
27
28
    public function incrementCurrentPosition()
29
    {
30
        $this->currentPosition++;
31
    }
32
33
    public function decrementCurrentPosition()
34
    {
35
        $this->currentPosition--;
36
    }
37
38
    public function getChangedLines(): array
39
    {
40
        return array_map('array_unique', $this->changeLines);
41
    }
42
}
43