@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | return $this->instance; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $this->instance = $this->getJobFactory()->create($this->payload['class'], $this->getArguments(), $this->queue); |
|
| 179 | - $this->instance->job = $this; |
|
| 180 | - return $this->instance; |
|
| 178 | + $this->instance = $this->getJobFactory()->create($this->payload['class'], $this->getArguments(), $this->queue); |
|
| 179 | + $this->instance->job = $this; |
|
| 180 | + return $this->instance; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -294,26 +294,26 @@ discard block |
||
| 294 | 294 | return $this; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - /** |
|
| 298 | - * @return Resque_Job_FactoryInterface |
|
| 299 | - */ |
|
| 300 | - public function getJobFactory() |
|
| 301 | - { |
|
| 302 | - if ($this->jobFactory === null) { |
|
| 303 | - $this->jobFactory = new Resque_Job_Factory(); |
|
| 304 | - } |
|
| 305 | - return $this->jobFactory; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * @return string |
|
| 310 | - */ |
|
| 311 | - private function getPrefix() |
|
| 312 | - { |
|
| 313 | - if (isset($this->payload['prefix'])) { |
|
| 314 | - return $this->payload['prefix']; |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - return ''; |
|
| 318 | - } |
|
| 297 | + /** |
|
| 298 | + * @return Resque_Job_FactoryInterface |
|
| 299 | + */ |
|
| 300 | + public function getJobFactory() |
|
| 301 | + { |
|
| 302 | + if ($this->jobFactory === null) { |
|
| 303 | + $this->jobFactory = new Resque_Job_Factory(); |
|
| 304 | + } |
|
| 305 | + return $this->jobFactory; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * @return string |
|
| 310 | + */ |
|
| 311 | + private function getPrefix() |
|
| 312 | + { |
|
| 313 | + if (isset($this->payload['prefix'])) { |
|
| 314 | + return $this->payload['prefix']; |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + return ''; |
|
| 318 | + } |
|
| 319 | 319 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $id = Resque::generateJobId(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if($args !== null && !is_array($args)) { |
|
| 67 | + if ($args !== null && !is_array($args)) { |
|
| 68 | 68 | throw new InvalidArgumentException( |
| 69 | 69 | 'Supplied $args must be an array.' |
| 70 | 70 | ); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | 'queue_time' => microtime(true), |
| 78 | 78 | )); |
| 79 | 79 | |
| 80 | - if($monitor) { |
|
| 80 | + if ($monitor) { |
|
| 81 | 81 | Resque_Job_Status::create($id, $prefix); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public static function reserve($queue) |
| 95 | 95 | { |
| 96 | 96 | $payload = Resque::pop($queue); |
| 97 | - if(!is_array($payload)) { |
|
| 97 | + if (!is_array($payload)) { |
|
| 98 | 98 | return false; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $item = Resque::blpop($queues, $timeout); |
| 115 | 115 | |
| 116 | - if(!is_array($item)) { |
|
| 116 | + if (!is_array($item)) { |
|
| 117 | 117 | return false; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function updateStatus($status, $result = null) |
| 129 | 129 | { |
| 130 | - if(empty($this->payload['id'])) { |
|
| 130 | + if (empty($this->payload['id'])) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function getStatus() |
| 144 | 144 | { |
| 145 | - if(empty($this->payload['id'])) { |
|
| 145 | + if (empty($this->payload['id'])) { |
|
| 146 | 146 | return null; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -194,20 +194,20 @@ discard block |
||
| 194 | 194 | Resque_Event::trigger('beforePerform', $this); |
| 195 | 195 | |
| 196 | 196 | $instance = $this->getInstance(); |
| 197 | - if(is_callable([$instance, 'setUp'])) { |
|
| 197 | + if (is_callable([$instance, 'setUp'])) { |
|
| 198 | 198 | $instance->setUp(); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $result = $instance->perform(); |
| 202 | 202 | |
| 203 | - if(is_callable([$instance, 'tearDown'])) { |
|
| 203 | + if (is_callable([$instance, 'tearDown'])) { |
|
| 204 | 204 | $instance->tearDown(); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | Resque_Event::trigger('afterPerform', $this); |
| 208 | 208 | } |
| 209 | 209 | // beforePerform/setUp have said don't perform this job. Return. |
| 210 | - catch(Resque_Job_DontPerform $e) { |
|
| 210 | + catch (Resque_Job_DontPerform $e) { |
|
| 211 | 211 | $result = false; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $monitor = false; |
| 256 | 256 | if (isset($this->payload['id'])) { |
| 257 | 257 | $status = new Resque_Job_Status($this->payload['id'], $this->getPrefix()); |
| 258 | - if($status->isTracking()) { |
|
| 258 | + if ($status->isTracking()) { |
|
| 259 | 259 | $monitor = true; |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -271,13 +271,13 @@ discard block |
||
| 271 | 271 | public function __toString() |
| 272 | 272 | { |
| 273 | 273 | $name = array( |
| 274 | - 'Job{' . $this->queue .'}' |
|
| 274 | + 'Job{' . $this->queue . '}' |
|
| 275 | 275 | ); |
| 276 | - if(!empty($this->payload['id'])) { |
|
| 276 | + if (!empty($this->payload['id'])) { |
|
| 277 | 277 | $name[] = 'ID: ' . $this->payload['id']; |
| 278 | 278 | } |
| 279 | 279 | $name[] = $this->payload['class']; |
| 280 | - if(!empty($this->payload['args'])) { |
|
| 280 | + if (!empty($this->payload['args'])) { |
|
| 281 | 281 | $name[] = json_encode($this->payload['args']); |
| 282 | 282 | } |
| 283 | 283 | return '(' . implode(' | ', $name) . ')'; |