| Total Complexity | 9 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class TaskRunContext extends RunContext |
||
| 13 | { |
||
| 14 | private $scheduleRunContext; |
||
| 15 | private $task; |
||
| 16 | |||
| 17 | private $result; |
||
| 18 | |||
| 19 | 54 | public function __construct(ScheduleRunContext $scheduleRunContext, Task $task) |
|
| 20 | { |
||
| 21 | 54 | $this->scheduleRunContext = $scheduleRunContext; |
|
| 22 | 54 | $this->task = $task; |
|
| 23 | |||
| 24 | 54 | parent::__construct(); |
|
| 25 | 54 | } |
|
| 26 | |||
| 27 | 1 | public function __toString(): string |
|
| 28 | { |
||
| 29 | 1 | return "{$this->task()->getType()}: {$this->task()}"; |
|
| 30 | } |
||
| 31 | |||
| 32 | 2 | public function scheduleRunContext(): ScheduleRunContext |
|
| 33 | { |
||
| 34 | 2 | return $this->scheduleRunContext; |
|
| 35 | } |
||
| 36 | |||
| 37 | 44 | public function task(): Task |
|
| 40 | } |
||
| 41 | |||
| 42 | 29 | public function result(): Result |
|
| 43 | { |
||
| 44 | 29 | $this->ensureHasRun(); |
|
| 45 | |||
| 46 | 28 | return $this->result; |
|
| 47 | } |
||
| 48 | |||
| 49 | 29 | public function setResult(Result $result): void |
|
| 60 | 28 | } |
|
| 61 | |||
| 62 | 28 | public function isSuccessful(): bool |
|
| 63 | { |
||
| 64 | 28 | return $this->result()->isSuccessful(); |
|
| 65 | } |
||
| 66 | |||
| 67 | 28 | public function isFailure(): bool |
|
| 70 | } |
||
| 71 | } |
||
| 72 |