1 | <?php |
||
7 | class Job extends BaseJob |
||
8 | { |
||
9 | const STATUS_EXPIRED = 'expired'; |
||
10 | |||
11 | protected $id; |
||
12 | protected $message; |
||
13 | protected $crcHash; |
||
14 | protected $expiresAt; |
||
15 | protected $delay; |
||
16 | protected $startedAt; |
||
17 | protected $maxDuration; |
||
18 | protected $runId; |
||
19 | protected $finishedAt; |
||
20 | protected $elapsed; |
||
21 | |||
22 | 6 | public function __call($method, $args) |
|
23 | { |
||
24 | 6 | $this->method = $method; |
|
25 | 6 | $this->setArgs($args); |
|
26 | |||
27 | // Make sure the method exists - job should not be created |
||
28 | 6 | if (!method_exists($this->worker, $method)) { |
|
29 | throw new \BadMethodCallException("{$this->className}->{$method}() does not exist"); |
||
30 | } |
||
31 | |||
32 | 6 | $job = $this->jobManager->save($this); |
|
33 | |||
34 | 6 | return $job; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return string|null |
||
39 | */ |
||
40 | 1 | public function getMessage() |
|
44 | |||
45 | /** |
||
46 | * @param string $message |
||
47 | */ |
||
48 | 3 | public function setMessage($message) |
|
54 | |||
55 | /** |
||
56 | * @return \DateTime|null |
||
57 | */ |
||
58 | 7 | public function getExpiresAt() |
|
62 | |||
63 | /** |
||
64 | * @param \DateTime $expiresAt |
||
65 | */ |
||
66 | 1 | public function setExpiresAt(\DateTime $expiresAt) |
|
72 | |||
73 | /** |
||
74 | * @return int |
||
75 | */ |
||
76 | 7 | public function getId() |
|
80 | |||
81 | /** |
||
82 | * @return string |
||
83 | */ |
||
84 | 7 | public function getCrcHash() |
|
88 | |||
89 | /** |
||
90 | * @param mixed $id |
||
91 | */ |
||
92 | 7 | public function setId($id) |
|
98 | |||
99 | /** |
||
100 | * @return \DateTime|null |
||
101 | */ |
||
102 | public function getStartedAt() |
||
106 | |||
107 | /** |
||
108 | * @param \DateTime|null $startedAt |
||
109 | */ |
||
110 | 2 | public function setStartedAt(\DateTime $startedAt = null) |
|
116 | |||
117 | /** |
||
118 | * @return int|null |
||
119 | */ |
||
120 | 1 | public function getMaxDuration() |
|
124 | |||
125 | /** |
||
126 | * @param int|null $maxDuration |
||
127 | */ |
||
128 | 1 | public function setMaxDuration($maxDuration) |
|
134 | |||
135 | /** |
||
136 | * @param string $crcHash |
||
137 | */ |
||
138 | 7 | public function setCrcHash($crcHash) |
|
144 | |||
145 | /** |
||
146 | * @param JobManagerInterface $jobManager |
||
147 | */ |
||
148 | 6 | public function setJobManager(JobManagerInterface $jobManager) |
|
154 | |||
155 | /** |
||
156 | * @return int |
||
157 | */ |
||
158 | 7 | public function getDelay() |
|
162 | |||
163 | /** |
||
164 | * @param int $delay Delay in seconds |
||
165 | */ |
||
166 | 2 | public function setDelay($delay) |
|
172 | |||
173 | /** |
||
174 | * @return mixed |
||
175 | */ |
||
176 | 1 | public function getRunId() |
|
180 | |||
181 | /** |
||
182 | * @param mixed $runId |
||
183 | */ |
||
184 | 4 | public function setRunId($runId) |
|
190 | |||
191 | /** |
||
192 | * @return \DateTime|null |
||
193 | */ |
||
194 | 1 | public function getFinishedAt() |
|
198 | |||
199 | /** |
||
200 | * @param \DateTime|null $finishedAt |
||
201 | */ |
||
202 | 1 | public function setFinishedAt($finishedAt) |
|
208 | |||
209 | /** |
||
210 | * @return int |
||
211 | */ |
||
212 | 1 | public function getElapsed() |
|
216 | |||
217 | /** |
||
218 | * @param int $elapsed |
||
219 | */ |
||
220 | 1 | public function setElapsed($elapsed) |
|
226 | } |
||
227 |