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