@@ -124,7 +124,7 @@ |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $replices = []; |
| 127 | - foreach($this->messages as $message) { |
|
| 127 | + foreach ($this->messages as $message) { |
|
| 128 | 128 | /** @var AMQPMessage $message */ |
| 129 | 129 | if (!$message->has('correlation_id')) { |
| 130 | 130 | $this->logger->error('unexpected message. rpc replies have no correlation_id '); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $this->container = $container; |
| 53 | 53 | |
| 54 | - $loader = new XmlFileLoader($this->container, new FileLocator(array(__DIR__ . '/../Resources/config'))); |
|
| 54 | + $loader = new XmlFileLoader($this->container, new FileLocator(array(__DIR__.'/../Resources/config'))); |
|
| 55 | 55 | $loader->load('rabbitmq.xml'); |
| 56 | 56 | |
| 57 | 57 | $configuration = $this->getConfiguration($configs, $container); |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function loadExchanges($exchanges): array |
| 105 | 105 | { |
| 106 | - return array_map(function ($exchange) { |
|
| 106 | + return array_map(function($exchange) { |
|
| 107 | 107 | $exchangeDeclaration = new Definition(ExchangeDeclaration::class); |
| 108 | 108 | $exchangeDeclaration->setProperties($exchange); |
| 109 | 109 | |
| 110 | - foreach($this->loadBindings($exchange['bindings'], $exchange['name'], null) as $binding) { |
|
| 110 | + foreach ($this->loadBindings($exchange['bindings'], $exchange['name'], null) as $binding) { |
|
| 111 | 111 | $this->container->getDefinition('old_sound_rabbit_mq.declaration_registry')->addMethodCall('addBinding', [$binding]); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function loadQueues($queues): array |
| 123 | 123 | { |
| 124 | - return array_map(function ($queue, $key) use ($queues) { |
|
| 124 | + return array_map(function($queue, $key) use ($queues) { |
|
| 125 | 125 | $queue['name'] = $queue['name'] ?? $key; |
| 126 | 126 | $queueDeclaration = new Definition(QueueDeclaration::class); |
| 127 | 127 | $queueDeclaration->setProperties($queue); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | foreach ($this->config['consumers'] as $consumerName => $consumer) { |
| 257 | 257 | $alias = sprintf('old_sound_rabbit_mq.consumer.%s', $consumerName); |
| 258 | - $serializerAlias = sprintf('old_sound_rabbit_mq.consumer.%s.serializer', $consumerName);// TODO |
|
| 258 | + $serializerAlias = sprintf('old_sound_rabbit_mq.consumer.%s.serializer', $consumerName); // TODO |
|
| 259 | 259 | |
| 260 | 260 | $connectionName = $consumer['connection'] ?? 'default'; |
| 261 | 261 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $definition->addTag('old_sound_rabbit_mq.consumer', ['consumer' => $consumerName]); |
| 267 | 267 | // TODO $this->container->setAlias($serializerAlias, SerializerInterface::class); |
| 268 | 268 | // $definition->addMethodCall('setSerializer', [new Reference($serializerAlias)]);} |
| 269 | - foreach($consumer['consumeQueues'] as $index => $consumeQueue) { |
|
| 269 | + foreach ($consumer['consumeQueues'] as $index => $consumeQueue) { |
|
| 270 | 270 | $queueConsumingDef = new Definition(ConsumeOptions::class); |
| 271 | 271 | $queueConsumingDef->setProperties([ |
| 272 | 272 | 'queueName' => $consumeQueue['queue'], |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $definition->addTag('monolog.logger', [ |
| 433 | 433 | 'channel' => 'phpamqplib' |
| 434 | 434 | ]); |
| 435 | - $loggerAlias = $definitionAlias . '.loggeer'; |
|
| 435 | + $loggerAlias = $definitionAlias.'.loggeer'; |
|
| 436 | 436 | $this->container->setAlias($loggerAlias, 'logger'); |
| 437 | 437 | $definition->addMethodCall('setLogger', [new Reference($loggerAlias, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); |
| 438 | 438 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $message = new AMQPMessage($body, ['content_type' => 'text/plain'] + $this->options->replayMessageProperties + [ |
| 53 | 53 | $this->options->correlationIdProperty => $correlationId, |
| 54 | 54 | ]); |
| 55 | - $channel->basic_publish($message , '', $replyTo); |
|
| 55 | + $channel->basic_publish($message, '', $replyTo); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function support($receiver): bool |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | new ConsoleLogger($output) |
| 114 | 114 | ); |
| 115 | 115 | $declarationRegistry = $this->container->get('old_sound_rabbit_mq.declaration_registry'); |
| 116 | - foreach($consumer->getConsumings() as $queueConsuming) { |
|
| 116 | + foreach ($consumer->getConsumings() as $queueConsuming) { |
|
| 117 | 117 | $declarator->declareForQueueDeclaration($queueConsuming->queue, $declarationRegistry); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | protected function setup(): Consumer |
| 77 | 77 | { |
| 78 | - foreach($this->consumings as $index => $consuming) { |
|
| 78 | + foreach ($this->consumings as $index => $consuming) { |
|
| 79 | 79 | $this->channel->basic_qos($consuming->options->qosPrefetchSize, $consuming->options->qosPrefetchCount, false); |
| 80 | 80 | |
| 81 | 81 | $options = $consuming->options; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $options->noAck, |
| 88 | 88 | $options->exclusive, |
| 89 | 89 | false, |
| 90 | - function (AMQPMessage $message) use ($consuming) { |
|
| 90 | + function(AMQPMessage $message) use ($consuming) { |
|
| 91 | 91 | $flags = $consuming->executeReceiverStrategy->onConsumeCallback($message); |
| 92 | 92 | if ($flags) { |
| 93 | 93 | $this->handleProcessMessages($flags, $consuming); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | break; |
| 201 | 201 | } |
| 202 | 202 | } catch (AMQPTimeoutException $e) { |
| 203 | - foreach($this->executeReceiverStrategies as $executeReceiverStrategy) { |
|
| 203 | + foreach ($this->executeReceiverStrategies as $executeReceiverStrategy) { |
|
| 204 | 204 | $executeReceiverStrategy->onCatchTimeout($e); |
| 205 | 205 | } |
| 206 | 206 | $now = new \DateTime(); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | private function handleProcessMessages(array $flags, Consuming $consuming) |
| 230 | 230 | { |
| 231 | - $ack = !array_search(fn ($reply) => $reply !== ReceiverInterface::MSG_ACK, $flags, true); |
|
| 231 | + $ack = !array_search(fn($reply) => $reply !== ReceiverInterface::MSG_ACK, $flags, true); |
|
| 232 | 232 | if ($this->multiAck && count($flags) > 1 && $ack) { |
| 233 | 233 | $lastDeliveryTag = array_key_last($flags); |
| 234 | 234 | |