| Total Complexity | 3 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | abstract class AbstractTask |
||
| 22 | { |
||
| 23 | /** @var array<string, string|int|null> */ |
||
| 24 | protected array $options = []; |
||
| 25 | |||
| 26 | protected Runtime $runtime; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get the Name/Code of the Task |
||
| 30 | */ |
||
| 31 | abstract public function getName(): string; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Get a short Description of the Task |
||
| 35 | */ |
||
| 36 | abstract public function getDescription(): string; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Executes the Command |
||
| 40 | */ |
||
| 41 | abstract public function execute(): bool; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Set additional Options for the Task |
||
| 45 | * |
||
| 46 | * @param array<string, string|int|null> $options |
||
| 47 | */ |
||
| 48 | 66 | public function setOptions(array $options = []): self |
|
| 49 | { |
||
| 50 | 66 | $this->options = array_merge($this->getDefaults(), $options); |
|
| 51 | 66 | return $this; |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Set the Runtime instance |
||
| 56 | */ |
||
| 57 | 77 | public function setRuntime(Runtime $runtime): self |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Return Default options |
||
| 65 | * |
||
| 66 | * @return array<string, string|int|null> |
||
| 67 | */ |
||
| 68 | 45 | public function getDefaults(): array |
|
| 73 |