Conditions | 6 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
16 | 3 | protected function ensureBinaryAvailable(string $binaryFile): void |
|
17 | { |
||
18 | // Case of binary (no path given), we cannot tell |
||
19 | 3 | if (basename($binaryFile) === $binaryFile) { |
|
20 | 1 | $exists = true; // assume it exists |
|
21 | 1 | $executable = true; |
|
22 | } else { |
||
23 | 2 | $exists = file_exists($binaryFile); |
|
24 | 2 | $executable = is_executable($binaryFile); |
|
25 | } |
||
26 | |||
27 | 3 | if (!$exists || !$executable) { |
|
28 | 1 | throw new MissingBinaryException(sprintf( |
|
29 | 1 | 'Missing \'%s\' binary: (exists: %s, executable: %s)', |
|
30 | 1 | $binaryFile, |
|
31 | 1 | $exists ? 'true' : 'false', |
|
32 | 1 | $executable ? 'true' : 'false' |
|
33 | )); |
||
37 |