Conditions | 3 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
58 | private function which(string $name): string |
||
59 | { |
||
60 | $isOsWin = stripos(PHP_OS, 'WIN') === 0; |
||
61 | |||
62 | $which = $isOsWin ? 'where' : 'which'; |
||
63 | $cmd = new ShellCommand(sprintf('%s %s', $which, escapeshellarg($name)), null); |
||
64 | $result = $cmd->run(); |
||
65 | |||
66 | return $result->getExitCode() > 0 |
||
67 | ? '' |
||
68 | : trim(current(explode(PHP_EOL, $result->getOutput()))); |
||
69 | } |
||
70 | } |