@@ -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 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | protected function setup(): Consumer |
91 | 91 | { |
92 | - foreach($this->consumings as $index => $consuming) { |
|
92 | + foreach ($this->consumings as $index => $consuming) { |
|
93 | 93 | $this->channel->basic_qos($consuming->options->qosPrefetchSize, $consuming->options->qosPrefetchCount, false); |
94 | 94 | |
95 | 95 | $options = $consuming->options; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $options->noAck, |
102 | 102 | $options->exclusive, |
103 | 103 | false, |
104 | - function (AMQPMessage $message) use ($consuming) { |
|
104 | + function(AMQPMessage $message) use ($consuming) { |
|
105 | 105 | $consuming->executeReceiverStrategy->onConsumeCallback($message); |
106 | 106 | $this->maybeStopConsumer(); |
107 | 107 | }); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | break; |
208 | 208 | } |
209 | 209 | } catch (AMQPTimeoutException $e) { |
210 | - foreach($this->executeReceiverStrategies as $executeReceiverStrategy) { |
|
210 | + foreach ($this->executeReceiverStrategies as $executeReceiverStrategy) { |
|
211 | 211 | $executeReceiverStrategy->onCatchTimeout($e); |
212 | 212 | } |
213 | 213 | $now = new \DateTime(); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | if (!$queueConsuming->noAck) { |
292 | 292 | $messages = array_combine( |
293 | - array_map(fn ($message) => $message->getDeliveryTag(), $messages), |
|
293 | + array_map(fn($message) => $message->getDeliveryTag(), $messages), |
|
294 | 294 | $messages |
295 | 295 | ); |
296 | 296 | |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | { |
307 | 307 | $executeReceiverStrategy = $this->getExecuteReceiverStrategy($queueConsuming); |
308 | 308 | |
309 | - $ack = !array_search(fn ($reply) => $reply !== ReceiverInterface::MSG_ACK, $replies, true); |
|
309 | + $ack = !array_search(fn($reply) => $reply !== ReceiverInterface::MSG_ACK, $replies, true); |
|
310 | 310 | if ($this->multiAck && count($messages) > 1 && $ack) { |
311 | - $channels = array_map(fn ($message) => $message->getChannel(), $messages); |
|
311 | + $channels = array_map(fn($message) => $message->getChannel(), $messages); |
|
312 | 312 | if (count($channels) !== array_unique($channels)) { // all messages have same channel |
313 | 313 | throw new InvalidArgumentException('Messages can not be processed as multi ack with different channels'); |
314 | 314 | } |
@@ -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 | } |