Conditions | 5 |
Paths | 8 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 5.0061 |
Changes | 0 |
1 | <?php |
||
36 | 2 | public function execute() |
|
37 | { |
||
38 | 2 | $errors = array(); |
|
39 | 2 | foreach ($this->requiredPrograms as $program => $howToInstallCommand) { |
|
40 | 2 | exec('command -v ' . escapeshellarg($program) . ' >/dev/null 2>&1', $output, $return); |
|
41 | 2 | if ($return !== 0) { |
|
42 | 1 | $errors[] = 'Required program "' . $program . '" is not installed.'; |
|
43 | 1 | if ($howToInstallCommand) { |
|
44 | 1 | $errors[] = 'You can fix this by running: ' . $howToInstallCommand; |
|
45 | 1 | } |
|
46 | 1 | } |
|
47 | 2 | } |
|
48 | |||
49 | 2 | if (!empty($errors)) { |
|
50 | 1 | $this->error(implode(PHP_EOL, $errors)); |
|
51 | } |
||
52 | |||
53 | 1 | $this->log('Required programs are installed.'); |
|
54 | 1 | } |
|
55 | |||
57 |