Binary   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 3
A getExecutable() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Gitilicious\GitClient\Cli\Input;
4
5
use Gitilicious\GitClient\Cli\NotFoundException;
6
use Gitilicious\GitClient\Cli\PermissionDeniedException;
7
8
class Binary
9
{
10
    private $binary;
11
12 3
    public function __construct(string $binary)
13
    {
14 3
        if (!is_file($binary)) {
15 1
            throw new NotFoundException(sprintf('The executable `%s` could not be found.', $binary));
16
        }
17
18 2
        if (!is_executable($binary)) {
19 1
            throw new PermissionDeniedException(sprintf('`%s` is not executable.', $binary));
20
        }
21
22 1
        $this->binary = $binary;
23 1
    }
24
25 1
    public function getExecutable(): string
26
    {
27 1
        return $this->binary;
28
    }
29
}
30