NewFile   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 3
A isValid() 0 3 2
1
<?php
2
namespace exussum12\CoverageChecker\DiffLineHandle\NewVersion;
3
4
use exussum12\CoverageChecker\DiffLineHandle;
5
6
class NewFile extends DiffLineHandle
7
{
8
    public function handle(string $line)
9
    {
10
        $parsedLine = sscanf($line, '+++ %1s/%s');
11
12
        if (empty($parsedLine[1])) {
13
            return;
14
        }
15
16
        $currentFileName = $parsedLine[1];
17
        if ($currentFileName) {
18
            $this->diffFileState->setCurrentFile($currentFileName);
19
        }
20
    }
21
22
    public function isValid(string $line): bool
23
    {
24
        return $line[0] == '+' && $line[1] == '+';
25
    }
26
}
27