1 | <?php |
||
7 | abstract class Job |
||
8 | { |
||
9 | protected bool $status = false; |
||
|
|||
10 | |||
11 | /** |
||
12 | * @var mixed |
||
13 | */ |
||
14 | protected $payload = null; |
||
15 | |||
16 | /** |
||
17 | * @param mixed $payload |
||
18 | */ |
||
19 | public function __construct($payload = null) |
||
20 | { |
||
21 | if (!$payload) { |
||
22 | return; |
||
23 | } |
||
24 | |||
25 | $this->setPayload($payload); |
||
26 | } |
||
27 | |||
28 | public function getQueue(): string |
||
29 | { |
||
30 | return get_class($this); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return mixed |
||
35 | */ |
||
36 | public function getPayload() |
||
37 | { |
||
38 | return $this->payload; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param mixed $payload |
||
43 | */ |
||
44 | public function setPayload($payload): void |
||
45 | { |
||
46 | $this->payload = $payload; |
||
47 | } |
||
48 | |||
49 | public function isPersistent(): bool |
||
50 | { |
||
51 | return false; |
||
52 | } |
||
53 | |||
54 | public function isFinished(): bool |
||
55 | { |
||
56 | return $this->status; |
||
57 | } |
||
58 | |||
59 | public function fail(): void |
||
60 | { |
||
61 | $this->status = false; |
||
62 | } |
||
63 | |||
64 | public function finish(): void |
||
65 | { |
||
71 |