1 | <?php |
||
24 | abstract class AbstractJob extends Component implements JobInterface |
||
25 | { |
||
26 | |||
27 | use JobTrait, OptionsTrait; |
||
28 | |||
29 | /** |
||
30 | * Event executed before a job is being executed. |
||
31 | */ |
||
32 | const EVENT_BEFORE_RUN = 'beforeRun'; |
||
33 | |||
34 | /** |
||
35 | * Event executed after a job is being executed. |
||
36 | */ |
||
37 | const EVENT_AFTER_RUN = 'afterRun'; |
||
38 | |||
39 | /** |
||
40 | * @return mixed |
||
41 | */ |
||
42 | abstract protected function runInternal(); |
||
43 | |||
44 | /** |
||
45 | * @param null $index |
||
46 | * @return bool |
||
47 | */ |
||
48 | public function toQueue($index = null): bool |
||
58 | |||
59 | /** |
||
60 | * @inheritdoc |
||
61 | */ |
||
62 | public function run() |
||
77 | |||
78 | /** |
||
79 | * @return bool |
||
80 | */ |
||
81 | protected function beforeRun() |
||
90 | |||
91 | /** |
||
92 | * @param $value |
||
93 | */ |
||
94 | protected function afterRun($value) |
||
103 | |||
104 | /** |
||
105 | * @return array |
||
106 | */ |
||
107 | public function toConfig(): array |
||
114 | } |
||
115 |