Result::getErrorMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Gitilicious\GitClient\Cli\Output;
4
5
class Result
6
{
7
    private $exitCode = 0;
8
9
    private $stdOut;
10
11
    private $stdErr;
12
13 21
    public function __construct(int $exitCode, string $stdOut, string $stdErr)
14
    {
15 21
        $this->exitCode = $exitCode;
16 21
        $this->stdOut   = new Output($stdOut);
17 21
        $this->stdErr   = new Output($stdErr);
18 21
    }
19
20 16
    public function isSuccess(): bool
21
    {
22 16
        return $this->exitCode === 0;
23
    }
24
25 2
    public function getOutput(): Output
26
    {
27 2
        return $this->stdOut;
28
    }
29
30 4
    public function getErrorMessage(): string
31
    {
32 4
        return $this->stdErr->getLine(1);
33
    }
34
}
35