Conditions | 3 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function run(): CommandResponse |
||
31 | { |
||
32 | $projectDirectory = $this->aliases->get('@root'); |
||
33 | |||
34 | $process = new Process($this->command); |
||
35 | |||
36 | $process |
||
37 | ->setWorkingDirectory($projectDirectory) |
||
38 | ->setTimeout(null) |
||
39 | ->run(); |
||
40 | |||
41 | $processOutput = $process->getOutput(); |
||
42 | |||
43 | if (!$process->getExitCode() > 1) { |
||
44 | return new CommandResponse( |
||
45 | status: CommandResponse::STATUS_FAIL, |
||
46 | result: null, |
||
47 | errors: array_filter([$processOutput, $process->getErrorOutput()]), |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | return new CommandResponse( |
||
52 | status: $process->isSuccessful() ? CommandResponse::STATUS_OK : CommandResponse::STATUS_ERROR, |
||
53 | result: $processOutput |
||
54 | ); |
||
57 |