@@ -20,30 +20,30 @@ |
||
| 20 | 20 | |
| 21 | 21 | private function registerAmqpServices(Container $app) |
| 22 | 22 | { |
| 23 | - $app['amqp.client'] = function ($c) { |
|
| 23 | + $app['amqp.client'] = function($c) { |
|
| 24 | 24 | return new Pecl($c['configuration']); |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | - $app['amqp.workerProvider'] = function ($c) { |
|
| 27 | + $app['amqp.workerProvider'] = function($c) { |
|
| 28 | 28 | return new Pimple($c); |
| 29 | 29 | }; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | private function registerConsumers(Container $app) |
| 33 | 33 | { |
| 34 | - $app['amqp.consumers.simple'] = function () { |
|
| 34 | + $app['amqp.consumers.simple'] = function() { |
|
| 35 | 35 | return new Consumers\Simple(); |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | - $app['amqp.consumers.insomniac'] = function () { |
|
| 38 | + $app['amqp.consumers.insomniac'] = function() { |
|
| 39 | 39 | return new Consumers\Insomniac(); |
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | - $app['amqp.consumers.retry'] = $app->protect(function (Container $c, $retries = null) { |
|
| 42 | + $app['amqp.consumers.retry'] = $app->protect(function(Container $c, $retries = null) { |
|
| 43 | 43 | return new Consumers\Retry($retries); |
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | - $app['amqp.consumers.instantRetry'] = $app->protect(function (Container $c, $retries, $delayInSeconds) { |
|
| 46 | + $app['amqp.consumers.instantRetry'] = $app->protect(function(Container $c, $retries, $delayInSeconds) { |
|
| 47 | 47 | return new Consumers\InstantRetry($retries, $delayInSeconds); |
| 48 | 48 | }); |
| 49 | 49 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $value = $input->getOption($name); |
| 80 | 80 | |
| 81 | - if(! in_array($value, ['true', 'false'])) |
|
| 81 | + if (!in_array($value, ['true', 'false'])) |
|
| 82 | 82 | { |
| 83 | 83 | throw new \InvalidArgumentException(sprintf('Invalid value "%s" for option %s, expecting boolean.', $value, $name)); |
| 84 | 84 | } |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | private function checkRequirements(InputInterface $input) |
| 90 | 90 | { |
| 91 | 91 | $destination = $input->getOption('destination'); |
| 92 | - if(empty($destination)) |
|
| 92 | + if (empty($destination)) |
|
| 93 | 93 | { |
| 94 | 94 | throw new \InvalidArgumentException('The option --destination is required.'); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $server = $input->getOption('server'); |
| 98 | - if(empty($server)) |
|
| 98 | + if (empty($server)) |
|
| 99 | 99 | { |
| 100 | 100 | throw new \InvalidArgumentException('The option --server is required.'); |
| 101 | 101 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $destination = $this->enforceEndingSlash($input->getOption('destination')); |
| 107 | 107 | |
| 108 | - if( ! $input->getOption('quiet')) |
|
| 108 | + if (!$input->getOption('quiet')) |
|
| 109 | 109 | { |
| 110 | 110 | $output->writeln(sprintf('<info>Destination : <comment>%s</comment></info>', $destination)); |
| 111 | 111 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $server = $input->getOption('server'); |
| 119 | 119 | |
| 120 | - if( ! $input->getOption('quiet')) |
|
| 120 | + if (!$input->getOption('quiet')) |
|
| 121 | 121 | { |
| 122 | 122 | $output->writeln(sprintf('<info>Server : <comment>%s</comment></info>', $server)); |
| 123 | 123 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $workerName = $input->getArgument('task'); |
| 48 | 48 | $workerContext = $this->workerProvider->getWorker($workerName); |
| 49 | 49 | |
| 50 | - if($workerContext instanceof WorkerContext) |
|
| 50 | + if ($workerContext instanceof WorkerContext) |
|
| 51 | 51 | { |
| 52 | 52 | $output->writeln("Launching <info>$workerName</info>"); |
| 53 | 53 | |
@@ -25,12 +25,12 @@ |
||
| 25 | 25 | protected function configure() |
| 26 | 26 | { |
| 27 | 27 | $this->setName('list') |
| 28 | - ->addArgument( |
|
| 29 | - 'workerNamePattern', |
|
| 30 | - InputArgument::OPTIONAL, |
|
| 31 | - 'Regex pattern of the worker name', |
|
| 32 | - null |
|
| 33 | - ) |
|
| 28 | + ->addArgument( |
|
| 29 | + 'workerNamePattern', |
|
| 30 | + InputArgument::OPTIONAL, |
|
| 31 | + 'Regex pattern of the worker name', |
|
| 32 | + null |
|
| 33 | + ) |
|
| 34 | 34 | ->setDescription('List AMQP workers'); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $workerNamePattern = $input->getArgument('workerNamePattern'); |
| 40 | 40 | |
| 41 | - if(!empty($workerNamePattern)) |
|
| 41 | + if (!empty($workerNamePattern)) |
|
| 42 | 42 | { |
| 43 | 43 | $comment = sprintf('List of worker with following pattern: %s', $workerNamePattern); |
| 44 | 44 | $services = $this->workerProvider->listWithRegexFilter($workerNamePattern); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $output->writeln(sprintf('<comment>%s</comment>', $comment)); |
| 53 | 53 | |
| 54 | - if(empty($services) || !is_array($services)) |
|
| 54 | + if (empty($services) || !is_array($services)) |
|
| 55 | 55 | { |
| 56 | 56 | $output->writeln('<error>No worker found</error>'); |
| 57 | 57 | return; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $style = new OutputFormatterStyle('cyan', null, array()); |
| 65 | 65 | $output->getFormatter()->setStyle('queue', $style); |
| 66 | 66 | |
| 67 | - foreach($services as $name => $info) |
|
| 67 | + foreach ($services as $name => $info) |
|
| 68 | 68 | { |
| 69 | 69 | $output->writeln(sprintf( |
| 70 | 70 | "<info> %s</info>%s\n\t<queue>--> %s</queue>\n", |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $comment = sprintf('List of worker with following pattern: %s', $workerNamePattern); |
| 44 | 44 | $services = $this->workerProvider->listWithRegexFilter($workerNamePattern); |
| 45 | - } |
|
| 46 | - else |
|
| 45 | + } else |
|
| 47 | 46 | { |
| 48 | 47 | $comment = 'List of all workers'; |
| 49 | 48 | $services = $this->workerProvider->listAll(); |