@@ -28,10 +28,10 @@ class Resque_Job implements Resque_JobInterface
28
28
*/
29
29
private $ instance ;
30
30
31
- /**
32
- * @var Resque_Job_FactoryInterface
33
- */
34
- private $ jobFactory ;
31
+ /**
32
+ * @var Resque_Job_FactoryInterface
33
+ */
34
+ private $ jobFactory ;
35
35
36
36
/**
37
37
* Instantiate a new instance of a job.
@@ -45,18 +45,18 @@ public function __construct($queue, $payload)
45
45
$ this ->payload = $ payload ;
46
46
}
47
47
48
- /**
49
- * Create a new job and save it to the specified queue.
50
- *
51
- * @param string $queue The name of the queue to place the job in.
52
- * @param string $class The name of the class that contains the code to execute the job.
53
- * @param array $args Any optional arguments that should be passed when the job is executed.
54
- * @param boolean $monitor Set to true to be able to monitor the status of a job.
55
- * @param string $id Unique identifier for tracking the job. Generated if not supplied.
56
- *
57
- * @return string
58
- * @throws \InvalidArgumentException
59
- */
48
+ /**
49
+ * Create a new job and save it to the specified queue.
50
+ *
51
+ * @param string $queue The name of the queue to place the job in.
52
+ * @param string $class The name of the class that contains the code to execute the job.
53
+ * @param array $args Any optional arguments that should be passed when the job is executed.
54
+ * @param boolean $monitor Set to true to be able to monitor the status of a job.
55
+ * @param string $id Unique identifier for tracking the job. Generated if not supplied.
56
+ *
57
+ * @return string
58
+ * @throws \InvalidArgumentException
59
+ */
60
60
public static function create ($ queue , $ class , $ args = null , $ monitor = false , $ id = null )
61
61
{
62
62
if (is_null ($ id )) {
@@ -82,41 +82,41 @@ public static function create($queue, $class, $args = null, $monitor = false, $i
82
82
return $ id ;
83
83
}
84
84
85
- /**
86
- * Find the next available job from the specified queue and return an
87
- * instance of Resque_Job for it.
88
- *
89
- * @param string $queue The name of the queue to check for a job in.
90
- * @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
91
- */
92
- public static function reserve ($ queue )
93
- {
94
- $ payload = Resque::pop ($ queue );
95
- if (!is_array ($ payload )) {
96
- return false ;
97
- }
98
-
99
- return new Resque_Job ($ queue , $ payload );
100
- }
101
-
102
- /**
103
- * Find the next available job from the specified queues using blocking list pop
104
- * and return an instance of Resque_Job for it.
105
- *
106
- * @param array $queues
107
- * @param int $timeout
108
- * @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
109
- */
110
- public static function reserveBlocking (array $ queues , $ timeout = null )
111
- {
112
- $ item = Resque::blpop ($ queues , $ timeout );
113
-
114
- if (!is_array ($ item )) {
115
- return false ;
116
- }
117
-
118
- return new Resque_Job ($ item ['queue ' ], $ item ['payload ' ]);
119
- }
85
+ /**
86
+ * Find the next available job from the specified queue and return an
87
+ * instance of Resque_Job for it.
88
+ *
89
+ * @param string $queue The name of the queue to check for a job in.
90
+ * @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
91
+ */
92
+ public static function reserve ($ queue )
93
+ {
94
+ $ payload = Resque::pop ($ queue );
95
+ if (!is_array ($ payload )) {
96
+ return false ;
97
+ }
98
+
99
+ return new Resque_Job ($ queue , $ payload );
100
+ }
101
+
102
+ /**
103
+ * Find the next available job from the specified queues using blocking list pop
104
+ * and return an instance of Resque_Job for it.
105
+ *
106
+ * @param array $queues
107
+ * @param int $timeout
108
+ * @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
109
+ */
110
+ public static function reserveBlocking (array $ queues , $ timeout = null )
111
+ {
112
+ $ item = Resque::blpop ($ queues , $ timeout );
113
+
114
+ if (!is_array ($ item )) {
115
+ return false ;
116
+ }
117
+
118
+ return new Resque_Job ($ item ['queue ' ], $ item ['payload ' ]);
119
+ }
120
120
121
121
/**
122
122
* Update the status of the current job.
@@ -158,11 +158,11 @@ public function getArguments()
158
158
return $ this ->payload ['args ' ][0 ];
159
159
}
160
160
161
- /**
162
- * Get the instantiated object for this job that will be performing work.
163
- * @return Resque_JobInterface Instance of the object that this job belongs to.
164
- * @throws Resque_Exception
165
- */
161
+ /**
162
+ * Get the instantiated object for this job that will be performing work.
163
+ * @return Resque_JobInterface Instance of the object that this job belongs to.
164
+ * @throws Resque_Exception
165
+ */
166
166
public function getInstance ()
167
167
{
168
168
if (!is_null ($ this ->instance )) {
@@ -181,14 +181,14 @@ public function getInstance()
181
181
);
182
182
}
183
183
184
- if ($ this ->jobFactory !== null ) {
185
- $ this ->instance = $ this ->jobFactory ->create ($ this ->payload ['class ' ], $ this ->getArguments (), $ this ->queue );
186
- return $ this ->instance ;
187
- }
188
- $ this ->instance = new $ this ->payload ['class ' ];
189
- $ this ->instance ->job = $ this ;
190
- $ this ->instance ->args = $ this ->getArguments ();
191
- $ this ->instance ->queue = $ this ->queue ;
184
+ if ($ this ->jobFactory !== null ) {
185
+ $ this ->instance = $ this ->jobFactory ->create ($ this ->payload ['class ' ], $ this ->getArguments (), $ this ->queue );
186
+ return $ this ->instance ;
187
+ }
188
+ $ this ->instance = new $ this ->payload ['class ' ];
189
+ $ this ->instance ->job = $ this ;
190
+ $ this ->instance ->args = $ this ->getArguments ();
191
+ $ this ->instance ->queue = $ this ->queue ;
192
192
193
193
return $ this ->instance ;
194
194
}
@@ -284,14 +284,14 @@ public function __toString()
284
284
return '( ' . implode (' | ' , $ name ) . ') ' ;
285
285
}
286
286
287
- /**
288
- * @param Resque_Job_FactoryInterface $jobFactory
289
- * @return Resque_Job
290
- */
291
- public function setJobFactory (Resque_Job_FactoryInterface $ jobFactory )
292
- {
293
- $ this ->jobFactory = $ jobFactory ;
287
+ /**
288
+ * @param Resque_Job_FactoryInterface $jobFactory
289
+ * @return Resque_Job
290
+ */
291
+ public function setJobFactory (Resque_Job_FactoryInterface $ jobFactory )
292
+ {
293
+ $ this ->jobFactory = $ jobFactory ;
294
294
295
- return $ this ;
296
- }
295
+ return $ this ;
296
+ }
297
297
}
0 commit comments