Output   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 24
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getNumberOfLines() 0 4 1
A getLine() 0 9 2
1
<?php declare(strict_types=1);
2
3
namespace Gitilicious\GitClient\Cli\Output;
4
5
class Output
6
{
7
    private $lines = [];
8
9 24
    public function __construct(string $output)
10
    {
11 24
        $this->lines = explode(PHP_EOL, trim($output));
12 24
    }
13
14 2
    public function getNumberOfLines(): int
15
    {
16 2
        return count($this->lines);
17
    }
18
19 7
    public function getLine(int $lineNumber): string
20
    {
21 7
        if (!array_key_exists($lineNumber - 1, $this->lines)) {
22
            // @todo or should we throw here instead?
23 1
            return '';
24
        }
25
26 6
        return $this->lines[$lineNumber - 1];
27
    }
28
}
29