5
5
use Resque \Job \PID ;
6
6
use Resque \Job \Status ;
7
7
use Resque \Exceptions \DoNotPerformException ;
8
+ use Resque \Exceptions \ResqueException ;
8
9
use Resque \Job \FactoryInterface ;
9
10
use Resque \Job \Factory ;
10
11
use Resque \Job \Job ;
@@ -25,7 +26,7 @@ class JobHandler
25
26
public $ queue ;
26
27
27
28
/**
28
- * @var \Resque\Worker\Resque Instance of the Resque worker running this job.
29
+ * @var \Resque\Worker\ResqueWorker Instance of the Resque worker running this job.
29
30
*/
30
31
public $ worker ;
31
32
@@ -50,7 +51,7 @@ class JobHandler
50
51
public $ endTime ;
51
52
52
53
/**
53
- * @var Job Instance of the class performing work for this job.
54
+ * @var Job|null Instance of the class performing work for this job.
54
55
*/
55
56
private $ instance ;
56
57
@@ -67,6 +68,7 @@ class JobHandler
67
68
*/
68
69
public function __construct ($ queue , $ payload )
69
70
{
71
+ $ this ->instance = null ;
70
72
$ this ->queue = $ queue ;
71
73
$ this ->payload = $ payload ;
72
74
$ this ->popTime = microtime (true );
@@ -79,12 +81,12 @@ public function __construct($queue, $payload)
79
81
/**
80
82
* Create a new job and save it to the specified queue.
81
83
*
82
- * @param string $queue The name of the queue to place the job in.
83
- * @param string $class The name of the class that contains the code to execute the job.
84
- * @param array $args Any optional arguments that should be passed when the job is executed.
85
- * @param boolean $monitor Set to true to be able to monitor the status of a job.
86
- * @param string $id Unique identifier for tracking the job. Generated if not supplied.
87
- * @param string $prefix The prefix needs to be set for the status key
84
+ * @param string $queue The name of the queue to place the job in.
85
+ * @param class- string $class The name of the class that contains the code to execute the job.
86
+ * @param array $args Any optional arguments that should be passed when the job is executed.
87
+ * @param boolean $monitor Set to true to be able to monitor the status of a job.
88
+ * @param string $id Unique identifier for tracking the job. Generated if not supplied.
89
+ * @param string $prefix The prefix needs to be set for the status key
88
90
*
89
91
* @return string
90
92
*/
@@ -201,7 +203,8 @@ public function getInstance(): Job
201
203
return $ this ->instance ;
202
204
}
203
205
204
- $ this ->instance = $ this ->getJobFactory ()->create ($ this ->payload ['class ' ], $ this ->getArguments (), $ this ->queue );
206
+ $ this ->instance = $ this ->getJobFactory ()
207
+ ->create ($ this ->payload ['class ' ], $ this ->getArguments (), $ this ->queue );
205
208
$ this ->instance ->job = $ this ;
206
209
$ this ->instance ->jobID = $ this ->payload ['id ' ];
207
210
return $ this ->instance ;
@@ -211,8 +214,8 @@ public function getInstance(): Job
211
214
* Actually execute a job by calling the perform method on the class
212
215
* associated with the job with the supplied arguments.
213
216
*
214
- * @return mixed
215
- * @throws Resque\Exceptions\ ResqueException When the job's class could not be found.
217
+ * @return bool
218
+ * @throws ResqueException When the job's class could not be found.
216
219
*/
217
220
public function perform ()
218
221
{
@@ -325,8 +328,8 @@ public function __toString()
325
328
}
326
329
327
330
/**
328
- * @param Resque\Job\FactoryInterface $jobFactory
329
- * @return Resque\JobHandler
331
+ * @param \ Resque\Job\FactoryInterface $jobFactory
332
+ * @return \ Resque\JobHandler
330
333
*/
331
334
public function setJobFactory (FactoryInterface $ jobFactory )
332
335
{
@@ -336,7 +339,7 @@ public function setJobFactory(FactoryInterface $jobFactory)
336
339
}
337
340
338
341
/**
339
- * @return Resque\Job\FactoryInterface
342
+ * @return \ Resque\Job\FactoryInterface
340
343
*/
341
344
public function getJobFactory (): FactoryInterface
342
345
{
0 commit comments