@@ -3,7 +3,7 @@ |
||
3 | 3 | { |
4 | 4 | public function perform() |
5 | 5 | { |
6 | - fwrite(STDOUT, 'Start job! -> '); |
|
6 | + fwrite(STDOUT, 'Start job! -> '); |
|
7 | 7 | sleep(1); |
8 | 8 | fwrite(STDOUT, 'Job ended!' . PHP_EOL); |
9 | 9 | } |
@@ -198,12 +198,12 @@ |
||
198 | 198 | |
199 | 199 | // Check the URI scheme |
200 | 200 | $validSchemes = array('redis', 'tcp'); |
201 | - if (isset($parts['scheme']) && ! in_array($parts['scheme'], $validSchemes)) { |
|
201 | + if (isset($parts['scheme']) && !in_array($parts['scheme'], $validSchemes)) { |
|
202 | 202 | throw new InvalidArgumentException("Invalid DSN. Supported schemes are " . implode(', ', $validSchemes)); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Allow simple 'hostname' format, which `parse_url` treats as a path, not host. |
206 | - if (! isset($parts['host']) && isset($parts['path'])) { |
|
206 | + if (!isset($parts['host']) && isset($parts['path'])) { |
|
207 | 207 | $parts['host'] = $parts['path']; |
208 | 208 | unset($parts['path']); |
209 | 209 | } |
@@ -195,11 +195,11 @@ |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Fetch a value from the status packet for the job being monitored. |
|
199 | - * |
|
200 | - * @return mixed False if the status is not being monitored, otherwise the |
|
201 | - * requested value from the status packet. |
|
202 | - */ |
|
198 | + * Fetch a value from the status packet for the job being monitored. |
|
199 | + * |
|
200 | + * @return mixed False if the status is not being monitored, otherwise the |
|
201 | + * requested value from the status packet. |
|
202 | + */ |
|
203 | 203 | protected function fetch($value = null) |
204 | 204 | { |
205 | 205 | if (!$this->isTracking()) { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'started' => time(), |
65 | 65 | 'result' => null, |
66 | 66 | ); |
67 | - Resque::redis()->set((string) $status, json_encode($statusPacket)); |
|
67 | + Resque::redis()->set((string)$status, json_encode($statusPacket)); |
|
68 | 68 | |
69 | 69 | return $status; |
70 | 70 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function update($status, $result = null) |
99 | 99 | { |
100 | - $status = (int) $status; |
|
100 | + $status = (int)$status; |
|
101 | 101 | |
102 | 102 | if (!$this->isTracking()) { |
103 | 103 | return; |
@@ -36,13 +36,13 @@ |
||
36 | 36 | private $paused = false; |
37 | 37 | |
38 | 38 | /** |
39 | - * The primary loop for a worker. |
|
40 | - * |
|
41 | - * Every $interval (seconds), the scheduled queue will be checked for jobs |
|
42 | - * that should be pushed to Resque. |
|
43 | - * |
|
44 | - * @param int $interval How often to check schedules. |
|
45 | - */ |
|
39 | + * The primary loop for a worker. |
|
40 | + * |
|
41 | + * Every $interval (seconds), the scheduled queue will be checked for jobs |
|
42 | + * that should be pushed to Resque. |
|
43 | + * |
|
44 | + * @param int $interval How often to check schedules. |
|
45 | + */ |
|
46 | 46 | public function work($interval = null) |
47 | 47 | { |
48 | 48 | if ($interval !== null) { |
@@ -34,8 +34,8 @@ |
||
34 | 34 | private static $processPrefix = 'resque'; |
35 | 35 | |
36 | 36 | /** |
37 | - * @var \Psr\Log\LoggerInterface Logging object that impliments the PSR-3 LoggerInterface |
|
38 | - */ |
|
37 | + * @var \Psr\Log\LoggerInterface Logging object that impliments the PSR-3 LoggerInterface |
|
38 | + */ |
|
39 | 39 | public $logger; |
40 | 40 | |
41 | 41 | /** |
@@ -532,7 +532,7 @@ |
||
532 | 532 | exec('WMIC path win32_process get Processid,Commandline | findstr resque | findstr /V findstr', $cmdOutput); |
533 | 533 | foreach ($cmdOutput as $line) { |
534 | 534 | $line = preg_replace('/\s+/m', ' ', $line); |
535 | - list(,,$pids[]) = explode(' ', trim($line), 3); |
|
535 | + list(,, $pids[]) = explode(' ', trim($line), 3); |
|
536 | 536 | } |
537 | 537 | } else { |
538 | 538 | exec('ps -A -o pid,args | grep [r]esque', $cmdOutput); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | if (empty($argv[2])) { |
21 | 21 | $jobId = \Resque\Resque::enqueue('default', $argv[1], $args, true); |
22 | 22 | } else { |
23 | - $jobId = \Resque\Resque::enqueue($argv[1], $argv[2], $args, true); |
|
23 | + $jobId = \Resque\Resque::enqueue($argv[1], $argv[2], $args, true); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | echo "Queued job ".$jobId."\n\n"; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(empty($argv[1])) { |
|
2 | +if (empty($argv[1])) { |
|
3 | 3 | die('Specify the name of a job to add. e.g, php queue.php PHP_Job'); |
4 | 4 | } |
5 | 5 | |
@@ -23,4 +23,4 @@ discard block |
||
23 | 23 | $jobId = \Resque\Resque::enqueue($argv[1], $argv[2], $args, true); |
24 | 24 | } |
25 | 25 | |
26 | -echo "Queued job ".$jobId."\n\n"; |
|
26 | +echo "Queued job " . $jobId . "\n\n"; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(empty($argv[1])) { |
|
2 | +if (empty($argv[1])) { |
|
3 | 3 | die('Specify the ID of a job to monitor the status of.'); |
4 | 4 | } |
5 | 5 | |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | //\Resque\Resque::setBackend('redis://user:[email protected]:3432/2'); |
13 | 13 | |
14 | 14 | $status = new \Resque\Job\Status($argv[1]); |
15 | -if(!$status->isTracking()) { |
|
15 | +if (!$status->isTracking()) { |
|
16 | 16 | die("Resque is not tracking the status of this job.\n"); |
17 | 17 | } |
18 | 18 | |
19 | -echo "Tracking status of ".$argv[1].". Press [break] to stop.\n\n"; |
|
20 | -while(true) { |
|
21 | - fwrite(STDOUT, "Status of ".$argv[1]." is: ".$status->get()."\n"); |
|
19 | +echo "Tracking status of " . $argv[1] . ". Press [break] to stop.\n\n"; |
|
20 | +while (true) { |
|
21 | + fwrite(STDOUT, "Status of " . $argv[1] . " is: " . $status->get() . "\n"); |
|
22 | 22 | sleep(1); |
23 | 23 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $redis = Resque::redis(); |
74 | 74 | $redis->rpush('delayed:' . $timestamp, json_encode($item)); |
75 | 75 | |
76 | - $redis->zadd('delayed_queue_schedule', $timestamp, (string) $timestamp); |
|
76 | + $redis->zadd('delayed_queue_schedule', $timestamp, (string)$timestamp); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | if ($redis->llen($key) == 0) { |
186 | 186 | $redis->del($key); |
187 | - $redis->zrem('delayed_queue_schedule', (string) $timestamp); |
|
187 | + $redis->zrem('delayed_queue_schedule', (string)$timestamp); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 |