Total Complexity | 6 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 10 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
16 | final class Job |
||
17 | { |
||
18 | use \Nette\SmartObject; |
||
19 | |||
20 | public readonly string $name; |
||
21 | /** @var callable Task */ |
||
22 | protected $callback; |
||
23 | public readonly array $params; |
||
24 | public readonly bool|string $skip; |
||
25 | protected JobResult $result = JobResult::PASSED; |
||
26 | protected string $output = ""; |
||
27 | /** @var callable[] */ |
||
28 | public array $onAfterExecute = []; |
||
29 | |||
30 | 1 | public function __construct( |
|
31 | string $name, |
||
32 | callable $callback, |
||
33 | array $params = [], |
||
34 | bool|string $skip = false, |
||
35 | array $onAfterExecute = [] |
||
36 | ) { |
||
37 | 1 | $this->name = $name; |
|
38 | 1 | $this->callback = $callback; |
|
39 | 1 | $this->params = $params; |
|
40 | 1 | $this->skip = $skip; |
|
41 | 1 | $this->onAfterExecute = $onAfterExecute; |
|
42 | } |
||
43 | |||
44 | 1 | protected function getCallback(): callable |
|
45 | { |
||
46 | 1 | return $this->callback; |
|
47 | } |
||
48 | |||
49 | 1 | protected function getResult(): JobResult |
|
50 | { |
||
51 | 1 | return $this->result; |
|
52 | } |
||
53 | |||
54 | 1 | protected function getOutput(): string |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * Executes the task |
||
61 | */ |
||
62 | 1 | public function execute(): void |
|
73 | } |
||
74 | } |
||
75 |