| Conditions | 3 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.0261 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | 4 | public function which(string $executable): string |
|
| 12 | { |
||
| 13 | 4 | $wichPath = '/usr/bin/which'; |
|
| 14 | 4 | if (! is_file($wichPath) || ! is_executable($wichPath)) { |
|
| 15 | throw new RuntimeException('Cannot find which command'); |
||
| 16 | } |
||
| 17 | 4 | return trim((string) shell_exec(implode(' ', [ |
|
| 18 | 4 | escapeshellarg($wichPath), |
|
| 19 | 4 | escapeshellarg($executable), |
|
| 20 | 4 | ]))); |
|
| 23 |