@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * @param Job $job |
| 191 | - * @return mixed |
|
| 191 | + * @return integer |
|
| 192 | 192 | */ |
| 193 | 193 | public function removedDelayed(Job $job) |
| 194 | 194 | { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
| 304 | - * @return mixed |
|
| 304 | + * @return integer |
|
| 305 | 305 | */ |
| 306 | 306 | public function getNumberOfDelayedJobs() |
| 307 | 307 | { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | 'port' => $port, |
| 84 | 84 | 'database' => $database, |
| 85 | 85 | ]; |
| 86 | - $host = substr($host, 0, 1) == '/' ? $host : $host . ':' . $port; |
|
| 86 | + $host = substr($host, 0, 1) == '/' ? $host : $host.':'.$port; |
|
| 87 | 87 | |
| 88 | 88 | \Resque::setBackend($host, $database); |
| 89 | 89 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function getQueues() |
| 224 | 224 | { |
| 225 | - return \array_map(function ($queue) { |
|
| 225 | + return \array_map(function($queue) { |
|
| 226 | 226 | return new Queue($queue); |
| 227 | 227 | }, \Resque::queues()); |
| 228 | 228 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function getWorkers() |
| 243 | 243 | { |
| 244 | - return \array_map(function ($worker) { |
|
| 244 | + return \array_map(function($worker) { |
|
| 245 | 245 | return new Worker($worker); |
| 246 | 246 | }, \Resque_Worker::all()); |
| 247 | 247 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | //TODO: find a more efficient way to do this |
| 295 | 295 | $out = []; |
| 296 | 296 | foreach ($timestamps as $timestamp) { |
| 297 | - $out[] = [$timestamp, \Resque::redis()->llen('delayed:' . $timestamp)]; |
|
| 297 | + $out[] = [$timestamp, \Resque::redis()->llen('delayed:'.$timestamp)]; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | return $out; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public function getJobsForTimestamp($timestamp) |
| 316 | 316 | { |
| 317 | - $jobs = \Resque::redis()->lrange('delayed:' . $timestamp, 0, -1); |
|
| 317 | + $jobs = \Resque::redis()->lrange('delayed:'.$timestamp, 0, -1); |
|
| 318 | 318 | $out = []; |
| 319 | 319 | foreach ($jobs as $job) { |
| 320 | 320 | $out[] = json_decode($job, TRUE); |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | public function clearQueue($queue) |
| 331 | 331 | { |
| 332 | - $length = \Resque::redis()->llen('queue:' . $queue); |
|
| 333 | - \Resque::redis()->del('queue:' . $queue); |
|
| 332 | + $length = \Resque::redis()->llen('queue:'.$queue); |
|
| 333 | + \Resque::redis()->del('queue:'.$queue); |
|
| 334 | 334 | |
| 335 | 335 | return $length; |
| 336 | 336 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $redisDatabase = $this->getContainer()->getParameter('resque.redis.database'); |
| 81 | 81 | |
| 82 | 82 | if ($redisHost != NULL && $redisPort != NULL) { |
| 83 | - $env['REDIS_BACKEND'] = $redisHost . ':' . $redisPort; |
|
| 83 | + $env['REDIS_BACKEND'] = $redisHost.':'.$redisPort; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if (isset($redisDatabase)) { |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $opt = ''; |
| 91 | - if (0 !== $m = (int)$input->getOption('memory-limit')) { |
|
| 91 | + if (0 !== $m = (int) $input->getOption('memory-limit')) { |
|
| 92 | 92 | $opt = sprintf('-d memory_limit=%dM', $m); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | if (version_compare(PHP_VERSION, '5.4.0') >= 0) { |
| 96 | 96 | $phpExecutable = PHP_BINARY; |
| 97 | 97 | } else { |
| 98 | - $phpExecutable = PHP_BINDIR . '/php'; |
|
| 98 | + $phpExecutable = PHP_BINDIR.'/php'; |
|
| 99 | 99 | if (defined('PHP_WINDOWS_VERSION_BUILD')) { |
| 100 | 100 | $phpExecutable = 'php'; |
| 101 | 101 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $workerCommand = strtr('%php% %opt% %dir%/resque', [ |
| 105 | 105 | '%php%' => $phpExecutable, |
| 106 | 106 | '%opt%' => $opt, |
| 107 | - '%dir%' => __DIR__ . '/../bin', |
|
| 107 | + '%dir%' => __DIR__.'/../bin', |
|
| 108 | 108 | ]); |
| 109 | 109 | |
| 110 | 110 | if (!$input->getOption('foreground')) { |
@@ -119,7 +119,7 @@ discard block |
||
| 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 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | // if foreground, we redirect output |
| 134 | 134 | if ($input->getOption('foreground')) { |
| 135 | - $process->run(function ($type, $buffer) use ($output) { |
|
| 135 | + $process->run(function($type, $buffer) use ($output) { |
|
| 136 | 136 | $output->write($buffer); |
| 137 | 137 | }); |
| 138 | 138 | } // else we recompose and display the worker id |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $queue = $input->getArgument('queue'); |
| 37 | 37 | $count = $resque->clearQueue($queue); |
| 38 | 38 | |
| 39 | - $output->writeln('Cleared queue ' . $queue . ' - removed ' . $count . ' entries'); |
|
| 39 | + $output->writeln('Cleared queue '.$queue.' - removed '.$count.' entries'); |
|
| 40 | 40 | |
| 41 | 41 | return 0; |
| 42 | 42 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected function execute(InputInterface $input, OutputInterface $output) |
| 37 | 37 | { |
| 38 | - $pidFile = $this->getContainer()->get('kernel')->getCacheDir() . '/resque_scheduledworker.pid'; |
|
| 38 | + $pidFile = $this->getContainer()->get('kernel')->getCacheDir().'/resque_scheduledworker.pid'; |
|
| 39 | 39 | if (file_exists($pidFile) && !$input->getOption('force')) { |
| 40 | 40 | throw new \Exception('PID file exists - use --force to override'); |
| 41 | 41 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $env = [ |
| 48 | 48 | 'APP_INCLUDE' => $this->getContainer()->getParameter('resque.app_include'), |
| 49 | 49 | 'VVERBOSE' => 1, |
| 50 | - 'RESQUE_PHP' => $this->getContainer()->getParameter('resque.vendor_dir') . '/chrisboulton/php-resque/lib/Resque.php', |
|
| 50 | + 'RESQUE_PHP' => $this->getContainer()->getParameter('resque.vendor_dir').'/chrisboulton/php-resque/lib/Resque.php', |
|
| 51 | 51 | 'INTERVAL' => $input->getOption('interval'), |
| 52 | 52 | ]; |
| 53 | 53 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $redisDatabase = $this->getContainer()->getParameter('resque.redis.database'); |
| 67 | 67 | |
| 68 | 68 | if ($redisHost != NULL && $redisPort != NULL) { |
| 69 | - $env['REDIS_BACKEND'] = $redisHost . ':' . $redisPort; |
|
| 69 | + $env['REDIS_BACKEND'] = $redisHost.':'.$redisPort; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if (isset($redisDatabase)) { |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | if (version_compare(PHP_VERSION, '5.4.0') >= 0) { |
| 77 | 77 | $phpExecutable = PHP_BINARY; |
| 78 | 78 | } else { |
| 79 | - $phpExecutable = PHP_BINDIR . '/php'; |
|
| 79 | + $phpExecutable = PHP_BINDIR.'/php'; |
|
| 80 | 80 | if (defined('PHP_WINDOWS_VERSION_BUILD')) { |
| 81 | 81 | $phpExecutable = 'php'; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $workerCommand = $phpExecutable . ' ' . __DIR__ . '/../bin/resque-scheduler'; |
|
| 85 | + $workerCommand = $phpExecutable.' '.__DIR__.'/../bin/resque-scheduler'; |
|
| 86 | 86 | |
| 87 | 87 | if (!$input->getOption('foreground')) { |
| 88 | 88 | $logFile = $this->getContainer()->getParameter( |
| 89 | 89 | 'kernel.logs_dir' |
| 90 | - ) . '/resque-scheduler_' . $this->getContainer()->getParameter('kernel.environment') . '.log'; |
|
| 91 | - $workerCommand = 'nohup ' . $workerCommand . ' > ' . $logFile . ' 2>&1 & echo $!'; |
|
| 90 | + ).'/resque-scheduler_'.$this->getContainer()->getParameter('kernel.environment').'.log'; |
|
| 91 | + $workerCommand = 'nohup '.$workerCommand.' > '.$logFile.' 2>&1 & echo $!'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // In windows: When you pass an environment to CMD it replaces the old environment |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // this is a workaround where we add the vars to the existing environment. |
| 97 | 97 | if (defined('PHP_WINDOWS_VERSION_BUILD')) { |
| 98 | 98 | foreach ($env as $key => $value) { |
| 99 | - putenv($key . "=" . $value); |
|
| 99 | + putenv($key."=".$value); |
|
| 100 | 100 | } |
| 101 | 101 | $env = NULL; |
| 102 | 102 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $output->writeln(\sprintf('Starting worker <info>%s</info>', $process->getCommandLine())); |
| 107 | 107 | |
| 108 | 108 | if ($input->getOption('foreground')) { |
| 109 | - $process->run(function ($type, $buffer) use ($output) { |
|
| 109 | + $process->run(function($type, $buffer) use ($output) { |
|
| 110 | 110 | $output->write($buffer); |
| 111 | 111 | }); |
| 112 | 112 | } // else we recompose and display the worker id |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | protected function execute(InputInterface $input, OutputInterface $output) |
| 31 | 31 | { |
| 32 | - $pidFile = $this->getContainer()->get('kernel')->getCacheDir() . '/resque_scheduledworker.pid'; |
|
| 32 | + $pidFile = $this->getContainer()->get('kernel')->getCacheDir().'/resque_scheduledworker.pid'; |
|
| 33 | 33 | |
| 34 | 34 | if (!file_exists($pidFile)) { |
| 35 | 35 | $output->writeln('No PID file found'); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $pid = file_get_contents($pidFile); |
| 41 | 41 | |
| 42 | - $output->writeln('Killing process ' . $pid); |
|
| 42 | + $output->writeln('Killing process '.$pid); |
|
| 43 | 43 | |
| 44 | 44 | \posix_kill($pid, SIGKILL); |
| 45 | 45 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $configuration = new Configuration(); |
| 23 | 23 | $config = $this->processConfiguration($configuration, $configs); |
| 24 | 24 | |
| 25 | - $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 25 | + $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 26 | 26 | $loader->load('services.xml'); |
| 27 | 27 | |
| 28 | 28 | $container->setParameter('resque.vendor_dir', $config['vendor_dir']); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function getJobs($start = 0, $stop = -1) |
| 43 | 43 | { |
| 44 | - $jobs = \Resque::redis()->lrange('queue:' . $this->name, $start, $stop); |
|
| 44 | + $jobs = \Resque::redis()->lrange('queue:'.$this->name, $start, $stop); |
|
| 45 | 45 | |
| 46 | 46 | $result = []; |
| 47 | 47 | foreach ($jobs as $job) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getId() |
| 39 | 39 | { |
| 40 | - return (string)$this->worker; |
|
| 40 | + return (string) $this->worker; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getQueues() |
| 47 | 47 | { |
| 48 | - return \array_map(function ($queue) { |
|
| 48 | + return \array_map(function($queue) { |
|
| 49 | 49 | return new Queue($queue); |
| 50 | 50 | }, $this->worker->queues()); |
| 51 | 51 | } |