| Conditions | 5 |
| Paths | 17 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5.0144 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 8 | public function execute(Task $task, Host $host): int |
|
| 32 | { |
||
| 33 | 8 | try { |
|
| 34 | Exception::setTaskSourceLocation($task->getSourceLocation()); |
||
| 35 | 8 | ||
| 36 | 8 | $context = new Context($host); |
|
| 37 | $task->run($context); |
||
| 38 | 8 | ||
| 39 | 2 | if ($task->getName() !== 'connect') { |
|
| 40 | 2 | $this->deployer->messenger->endOnHost($host); |
|
| 41 | 2 | } |
|
| 42 | 1 | return 0; |
|
| 43 | } catch (Throwable $e) { |
||
| 44 | 1 | $this->deployer->messenger->renderException($e, $host); |
|
| 45 | 1 | if ($e instanceof GracefulShutdownException) { |
|
| 46 | return GracefulShutdownException::EXIT_CODE; |
||
| 47 | } |
||
| 48 | if ($e instanceof RunException) { |
||
| 49 | return $e->getExitCode(); |
||
| 50 | } |
||
| 51 | return 255; |
||
| 52 | } |
||
| 55 |