| Total Complexity | 5 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class MockTask extends Task implements SelfRunningTask |
||
| 13 | { |
||
| 14 | private $result; |
||
| 15 | |||
| 16 | public function __construct(string $description = 'my task') |
||
| 19 | } |
||
| 20 | |||
| 21 | public function __invoke(): Result |
||
| 24 | } |
||
| 25 | |||
| 26 | public static function success(string $name = 'my task', string $output = null): self |
||
| 27 | { |
||
| 28 | $task = new self($name); |
||
| 29 | $task->result = Result::successful($task, $output); |
||
| 30 | |||
| 31 | return $task; |
||
| 32 | } |
||
| 33 | |||
| 34 | public static function failure(string $description = 'failure description', string $name = 'my task', string $output = null): self |
||
| 35 | { |
||
| 36 | $task = new self($name); |
||
| 37 | $task->result = Result::failure($task, $description, $output); |
||
| 38 | |||
| 39 | return $task; |
||
| 40 | } |
||
| 41 | |||
| 42 | public static function exception(\Throwable $e, string $name = 'my task', string $output = null): self |
||
| 48 | } |
||
| 49 | } |
||
| 50 |