Completed
Branch master (2da4a2)
by Phil
28s
created
Category
Command/ClearQueueCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         $queue = $input->getArgument('queue');
47 47
         $count = $this->resque->clearQueue($queue);
48 48
 
49
-        $output->writeln('Cleared queue '.$queue.' - removed '.$count.' entries');
49
+        $output->writeln('Cleared queue ' . $queue . ' - removed ' . $count . ' entries');
50 50
 
51 51
         return 0;
52 52
     }
Please login to merge, or discard this patch.
Command/StartScheduledWorkerCommand.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     protected function execute(InputInterface $input, OutputInterface $output)
50 50
     {
51
-        $pidFile = $this->params->get('kernel.cache_dir').'/resque_scheduledworker.pid';
51
+        $pidFile = $this->params->get('kernel.cache_dir') . '/resque_scheduledworker.pid';
52 52
         if (file_exists($pidFile) && !$input->getOption('force')) {
53 53
             throw new \Exception('PID file exists - use --force to override');
54 54
         }
@@ -60,31 +60,31 @@  discard block
 block discarded – undo
60 60
         $env = [
61 61
             'APP_INCLUDE' => $this->params->get('resque.app_include'),
62 62
             'VVERBOSE'    => 1,
63
-            'RESQUE_PHP'  => $this->params->get('resque.vendor_dir').'/chrisboulton/php-resque/lib/Resque.php',
63
+            'RESQUE_PHP'  => $this->params->get('resque.vendor_dir') . '/chrisboulton/php-resque/lib/Resque.php',
64 64
             'INTERVAL'    => $input->getOption('interval'),
65 65
         ];
66 66
 
67 67
         if (!file_exists($env['RESQUE_PHP'])) {
68
-            $env['RESQUE_PHP'] =  $this->params->get('resque.vendor_dir').'/resque/php-resque/lib/Resque.php';
68
+            $env['RESQUE_PHP'] = $this->params->get('resque.vendor_dir') . '/resque/php-resque/lib/Resque.php';
69 69
         }
70 70
 
71 71
         if (false !== getenv('APP_INCLUDE')) {
72 72
             $env['APP_INCLUDE'] = getenv('APP_INCLUDE');
73 73
         }
74 74
 
75
-        $prefix =  $this->params->get('resque.prefix');
75
+        $prefix = $this->params->get('resque.prefix');
76 76
 
77 77
         if (!empty($prefix)) {
78
-            $env['PREFIX'] =  $this->params->get('resque.prefix');
78
+            $env['PREFIX'] = $this->params->get('resque.prefix');
79 79
         }
80 80
 
81
-        $redisHost     =  $this->params->get('resque.redis.host');
82
-        $redisPort     =  $this->params->get('resque.redis.port');
83
-        $redisDatabase =  $this->params->get('resque.redis.database');
84
-        $redisPassword =  $this->params->get('resque.redis.password');
81
+        $redisHost     = $this->params->get('resque.redis.host');
82
+        $redisPort     = $this->params->get('resque.redis.port');
83
+        $redisDatabase = $this->params->get('resque.redis.database');
84
+        $redisPassword = $this->params->get('resque.redis.password');
85 85
 
86 86
         if (null != $redisHost && null != $redisPort) {
87
-            $env['REDIS_BACKEND'] = $redisHost.':'.$redisPort;
87
+            $env['REDIS_BACKEND'] = $redisHost . ':' . $redisPort;
88 88
         }
89 89
 
90 90
         if (isset($redisDatabase)) {
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
         if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
99 99
             $phpExecutable = PHP_BINARY;
100 100
         } else {
101
-            $phpExecutable = PHP_BINDIR.'/php';
101
+            $phpExecutable = PHP_BINDIR . '/php';
102 102
             if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
103 103
                 $phpExecutable = 'php';
104 104
             }
105 105
         }
106 106
 
107
-        $workdirectory = __DIR__.'/../bin/';
108
-        $workerCommand = $phpExecutable.' '.$workdirectory.'resque-scheduler';
107
+        $workdirectory = __DIR__ . '/../bin/';
108
+        $workerCommand = $phpExecutable . ' ' . $workdirectory . 'resque-scheduler';
109 109
 
110 110
         if (!$input->getOption('foreground')) {
111
-            $logFile =  $this->params->get(
111
+            $logFile = $this->params->get(
112 112
                     'kernel.logs_dir'
113
-                ).'/resque-scheduler_'.$this->params->get('kernel.environment').'.log';
114
-            $workerCommand = 'nohup '.$workerCommand.' > '.$logFile.' 2>&1 & echo $!';
113
+                ) . '/resque-scheduler_' . $this->params->get('kernel.environment') . '.log';
114
+            $workerCommand = 'nohup ' . $workerCommand . ' > ' . $logFile . ' 2>&1 & echo $!';
115 115
         }
116 116
 
117 117
         // In windows: When you pass an environment to CMD it replaces the old environment
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         // this is a workaround where we add the vars to the existing environment.
120 120
         if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
121 121
             foreach ($env as $key => $value) {
122
-                putenv($key.'='.$value);
122
+                putenv($key . '=' . $value);
123 123
             }
124 124
             $env = null;
125 125
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $output->writeln(sprintf('Starting worker <info>%s</info>', $process->getCommandLine()));
130 130
 
131 131
         if ($input->getOption('foreground')) {
132
-            $process->run(function ($type, $buffer) use ($output) {
132
+            $process->run(function($type, $buffer) use ($output) {
133 133
                 $output->write($buffer);
134 134
             });
135 135
         } // else we recompose and display the worker id
Please login to merge, or discard this patch.
Command/StopScheduledWorkerCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function execute(InputInterface $input, OutputInterface $output)
43 43
     {
44
-        $pidFile = $this->params->get('kernel.cache_dir').'/resque_scheduledworker.pid';
44
+        $pidFile = $this->params->get('kernel.cache_dir') . '/resque_scheduledworker.pid';
45 45
 
46 46
         if (!file_exists($pidFile)) {
47 47
             $output->writeln('No PID file found');
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         $pid = file_get_contents($pidFile);
53 53
 
54
-        $output->writeln('Killing process '.$pid);
54
+        $output->writeln('Killing process ' . $pid);
55 55
 
56 56
         posix_kill($pid, SIGKILL);
57 57
 
Please login to merge, or discard this patch.
Command/StartWorkerCommand.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
             );
65 65
         }
66 66
 
67
-        $env['APP_INCLUDE'] =  $this->params->get('resque.app_include');
67
+        $env['APP_INCLUDE'] = $this->params->get('resque.app_include');
68 68
         $env['COUNT']       = $input->getOption('count');
69 69
         $env['INTERVAL']    = $input->getOption('interval');
70 70
         $env['QUEUE']       = $input->getArgument('queues');
71 71
 
72 72
         // Allow Sentry.io integration
73 73
         if ($this->params->has('sentry.dsn')) {
74
-            if ($sentryDSN =  $this->params->get('sentry.dsn')) {
75
-                $output->writeln('Enabling Sentry Reporting to DSN '.$sentryDSN);
74
+            if ($sentryDSN = $this->params->get('sentry.dsn')) {
75
+                $output->writeln('Enabling Sentry Reporting to DSN ' . $sentryDSN);
76 76
                 $env['SENTRY_DSN'] = $sentryDSN;
77 77
             }
78 78
         }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             $env['APP_INCLUDE'] = getenv('APP_INCLUDE');
82 82
         }
83 83
 
84
-        $prefix =  $this->params->get('resque.prefix');
84
+        $prefix = $this->params->get('resque.prefix');
85 85
         if (!empty($prefix)) {
86
-            $env['PREFIX'] =  $this->params->get('resque.prefix');
86
+            $env['PREFIX'] = $this->params->get('resque.prefix');
87 87
         }
88 88
 
89 89
         if ($input->getOption('verbose')) {
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
             unset($env['VERBOSE']);
95 95
         }
96 96
 
97
-        $redisHost     =  $this->params->get('resque.redis.host');
98
-        $redisPort     =  $this->params->get('resque.redis.port');
99
-        $redisDatabase =  $this->params->get('resque.redis.database');
97
+        $redisHost     = $this->params->get('resque.redis.host');
98
+        $redisPort     = $this->params->get('resque.redis.port');
99
+        $redisDatabase = $this->params->get('resque.redis.database');
100 100
 
101 101
         if (null != $redisHost && null != $redisPort) {
102
-            $env['REDIS_BACKEND'] = $redisHost.':'.$redisPort;
102
+            $env['REDIS_BACKEND'] = $redisHost . ':' . $redisPort;
103 103
         }
104 104
 
105 105
         if (isset($redisDatabase)) {
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
         }
108 108
 
109 109
         $opt = '';
110
-        if (0 !== $m = (int) $input->getOption('memory-limit')) {
110
+        if (0 !== $m = (int)$input->getOption('memory-limit')) {
111 111
             $opt = sprintf('-d memory_limit=%dM', $m);
112 112
         }
113 113
 
114 114
         if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
115 115
             $phpExecutable = PHP_BINARY;
116 116
         } else {
117
-            $phpExecutable = PHP_BINDIR.'/php';
117
+            $phpExecutable = PHP_BINDIR . '/php';
118 118
             if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
119 119
                 $phpExecutable = 'php';
120 120
             }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $workerCommand = strtr('%php% %opt% %dir%/resque', [
124 124
             '%php%' => $phpExecutable,
125 125
             '%opt%' => $opt,
126
-            '%dir%' => __DIR__.'/../bin',
126
+            '%dir%' => __DIR__ . '/../bin',
127 127
         ]);
128 128
 
129 129
         if (!$input->getOption('foreground')) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         // this is a workaround where we add the vars to the existing environment.
139 139
         if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
140 140
             foreach ($env as $key => $value) {
141
-                putenv($key.'='.$value);
141
+                putenv($key . '=' . $value);
142 142
             }
143 143
             $env = null;
144 144
         }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         // if foreground, we redirect output
153 153
         if ($input->getOption('foreground')) {
154
-            $process->run(function ($type, $buffer) use ($output) {
154
+            $process->run(function($type, $buffer) use ($output) {
155 155
                 $output->write($buffer);
156 156
             });
157 157
         } // else we recompose and display the worker id
Please login to merge, or discard this patch.
Resque.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         ];
93 93
 
94 94
         if (!isset($password)) {
95
-            \Resque::setBackend($host.':'.$port, $database);
95
+            \Resque::setBackend($host . ':' . $port, $database);
96 96
         } else {
97 97
             $server = 'redis://:' . $password . '@' . $host . ':' . $port;
98 98
             \Resque::setBackend($server, $database);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      */
264 264
     public function getQueues()
265 265
     {
266
-        return array_map(function ($queue) {
266
+        return array_map(function($queue) {
267 267
             return new Queue($queue);
268 268
         }, \Resque::queues());
269 269
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      */
284 284
     public function getWorkers()
285 285
     {
286
-        return array_map(function ($worker) {
286
+        return array_map(function($worker) {
287 287
             return new Worker($worker);
288 288
         }, \Resque_Worker::all());
289 289
     }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      */
294 294
     public function getRunningWorkers()
295 295
     {
296
-        return array_filter($this->getWorkers(), function (Worker $worker) {
296
+        return array_filter($this->getWorkers(), function(Worker $worker) {
297 297
             return null !== $worker->getCurrentJob();
298 298
         });
299 299
     }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         //TODO: find a more efficient way to do this
371 371
         $out = [];
372 372
         foreach ($timestamps as $timestamp) {
373
-            $out[] = [$timestamp, \Resque::redis()->llen('delayed:'.$timestamp)];
373
+            $out[] = [$timestamp, \Resque::redis()->llen('delayed:' . $timestamp)];
374 374
         }
375 375
 
376 376
         return $out;
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
      */
392 392
     public function getJobsForTimestamp($timestamp)
393 393
     {
394
-        $jobs = \Resque::redis()->lrange('delayed:'.$timestamp, 0, -1);
394
+        $jobs = \Resque::redis()->lrange('delayed:' . $timestamp, 0, -1);
395 395
         $out  = [];
396 396
         foreach ($jobs as $job) {
397 397
             $out[] = json_decode($job, true);
Please login to merge, or discard this patch.
ContainerAwareJob.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     protected function createKernel()
57 57
     {
58 58
         $finder = new Finder();
59
-        $finder->name('*Kernel.php')->depth('<=1')->in($this->args['kernel.project_dir'].'/src');
59
+        $finder->name('*Kernel.php')->depth('<=1')->in($this->args['kernel.project_dir'] . '/src');
60 60
         $results = iterator_to_array($finder);
61 61
         $file    = current($results);
62 62
         $class   = $file->getBasename('.php');
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
         // Take into account any namespace
65 65
         preg_match('/namespace\s(.*)\;/', file_get_contents($file), $matches);
66 66
         if (2 == \count($matches)) {
67
-            $namespace = '\\'.$matches[1].'\\';
68
-            $class     = $namespace.$class;
67
+            $namespace = '\\' . $matches[1] . '\\';
68
+            $class     = $namespace . $class;
69 69
         }
70 70
 
71 71
         require_once $file;
Please login to merge, or discard this patch.
Controller/DefaultController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $count = $queue->clear();
77 77
         $queue->remove();
78 78
 
79
-        $this->addFlash('info', 'Remove '.$queue->getName().' queue and '.$count.' jobs.');
79
+        $this->addFlash('info', 'Remove ' . $queue->getName() . ' queue and ' . $count . ' jobs.');
80 80
 
81 81
         return $this->redirectToRoute('ResqueBundle_homepage');
82 82
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $count = $this->resque->retryFailedJobs();
185 185
 
186
-        $this->addFlash('info', 'Retry '.$count.' failed jobs.');
186
+        $this->addFlash('info', 'Retry ' . $count . ' failed jobs.');
187 187
 
188 188
         return $this->redirectToRoute('ResqueBundle_homepage');
189 189
     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     {
196 196
         $count = $this->resque->retryFailedJobs(true);
197 197
 
198
-        $this->addFlash('info', 'Retry and clear '.$count.' failed jobs.');
198
+        $this->addFlash('info', 'Retry and clear ' . $count . ' failed jobs.');
199 199
 
200 200
         return $this->redirectToRoute('ResqueBundle_homepage');
201 201
     }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     {
208 208
         $count = $this->resque->clearFailedJobs();
209 209
 
210
-        $this->addFlash('info', 'Clear '.$count.' failed jobs.');
210
+        $this->addFlash('info', 'Clear ' . $count . ' failed jobs.');
211 211
 
212 212
         return $this->redirectToRoute('ResqueBundle_homepage');
213 213
     }
Please login to merge, or discard this patch.
Worker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function getId()
45 45
     {
46
-        return (string) $this->worker;
46
+        return (string)$this->worker;
47 47
     }
48 48
 
49 49
     /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function getQueues()
53 53
     {
54
-        return array_map(function ($queue) {
54
+        return array_map(function($queue) {
55 55
             return new Queue($queue);
56 56
         }, $this->worker->queues());
57 57
     }
Please login to merge, or discard this patch.
Queue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getJobs($start = 0, $stop = -1)
49 49
     {
50
-        $jobs = \Resque::redis()->lrange('queue:'.$this->name, $start, $stop);
50
+        $jobs = \Resque::redis()->lrange('queue:' . $this->name, $start, $stop);
51 51
 
52 52
         $result = [];
53 53
         foreach ($jobs as $job) {
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function clear()
70 70
     {
71
-        $length = \Resque::redis()->llen('queue:'.$this->name);
72
-        \Resque::redis()->del('queue:'.$this->name);
71
+        $length = \Resque::redis()->llen('queue:' . $this->name);
72
+        \Resque::redis()->del('queue:' . $this->name);
73 73
 
74 74
         return $length;
75 75
     }
Please login to merge, or discard this patch.