@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | $connection = $input->getArgument('connection'); |
44 | 44 | $channelAlias = sprintf('old_sound_rabbit_mq.channel.%s', $connection); |
45 | - if(!$this->container->has($channelAlias)) { |
|
45 | + if (!$this->container->has($channelAlias)) { |
|
46 | 46 | throw new InvalidOptionException('Connection is not exist'); |
47 | 47 | }; |
48 | 48 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function getBindingsByExchange(ExchangeDeclaration $exchange): array |
37 | 37 | { |
38 | - return array_filter($this->bindings, function ($binding) use ($exchange) { |
|
38 | + return array_filter($this->bindings, function($binding) use ($exchange) { |
|
39 | 39 | return $binding->exchange === $exchange->name || ($binding->destinationIsExchange && $binding->destination === $exchange->name); |
40 | 40 | }); |
41 | 41 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function declure() { |
40 | 40 | foreach ($this->queues as $name => $options) { |
41 | - list($queueName, ,) = $this->getChannel()->queue_declare($name, $options['passive'], |
|
41 | + list($queueName,,) = $this->getChannel()->queue_declare($name, $options['passive'], |
|
42 | 42 | $options['durable'], $options['exclusive'], |
43 | 43 | $options['auto_delete'], $options['nowait'], |
44 | 44 | $options['arguments'], $options['ticket']); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $consumer = new Consumer($consumerDef->name); |
27 | 27 | $consumer->setChannel($connection->channel()); |
28 | 28 | |
29 | - foreach([] as $d) { |
|
29 | + foreach ([] as $d) { |
|
30 | 30 | $consumer->consumeQueue(); |
31 | 31 | } |
32 | 32 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function declareForExchange(ExchangeDeclaration $exchange, DeclarationsRegistry $declarationsRegistry) |
107 | 107 | { |
108 | 108 | $bindings = $declarationsRegistry->getBindingsByExchange($exchange); |
109 | - $queues = array_filter($bindings, function ($binding) use($exchange) { |
|
109 | + $queues = array_filter($bindings, function($binding) use($exchange) { |
|
110 | 110 | false === $binding->destinationIsExchange && $binding->destination == $exchange->name; |
111 | 111 | }); |
112 | 112 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | public function declareForQueueDeclaration(string $queueName, DeclarationsRegistry $declarationsRegistry) |
119 | 119 | { |
120 | - $consumerQueues = array_filter($declarationsRegistry->queues, function ($queue) use ($queueName) { |
|
120 | + $consumerQueues = array_filter($declarationsRegistry->queues, function($queue) use ($queueName) { |
|
121 | 121 | return $queue->name === $queueName; |
122 | 122 | // TODO not found! exception? |
123 | 123 | }); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $bindings = []; |
127 | 127 | $exchanges = []; |
128 | 128 | foreach ($consumerQueues as $queue) { |
129 | - $b = array_filter($declarationsRegistry->bindings, function ($binding) use ($queue) { |
|
129 | + $b = array_filter($declarationsRegistry->bindings, function($binding) use ($queue) { |
|
130 | 130 | return !$binding->destinationIsExchange && $binding->destination === $queue->name; |
131 | 131 | }); |
132 | 132 | $bindings = array_merge($bindings, $b); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - $exchanges = array_map(fn ($exchange) => $declarationsRegistry->exchanges[$exchange], array_unique($exchanges)); |
|
141 | + $exchanges = array_map(fn($exchange) => $declarationsRegistry->exchanges[$exchange], array_unique($exchanges)); |
|
142 | 142 | $this->declareExchanges($exchanges); |
143 | 143 | $this->declareQueues($consumerQueues); |
144 | 144 | $this->declareBindings($bindings); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | public function declareForQueue(QueueDeclaration $queue) |
148 | 148 | { |
149 | - $exchanges = array_map(function ($binding) { |
|
149 | + $exchanges = array_map(function($binding) { |
|
150 | 150 | return $binding->exchange; |
151 | 151 | }, $queue->bindings); |
152 | 152 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function process(ContainerBuilder $container) |
14 | 14 | { |
15 | 15 | $taggedConsumers = $container->findTaggedServiceIds('old_sound_rabbit_mq.consumer'); |
16 | - $consumerNames = array_map(fn ($tags) => $tags[0]['consumer'], $taggedConsumers); |
|
16 | + $consumerNames = array_map(fn($tags) => $tags[0]['consumer'], $taggedConsumers); |
|
17 | 17 | $container->setParameter('old_sound_rabbit_mq.allowed_consumer_names', $consumerNames); |
18 | 18 | } |
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | foreach ($taggedProducers as $id => $tags) { |
24 | 24 | $producerName = $tags[0]['producer']; |
25 | - $originLogger = $id . '.logger'; |
|
25 | + $originLogger = $id.'.logger'; |
|
26 | 26 | |
27 | 27 | if ($container->hasDefinition($originLogger)) { |
28 | 28 | $consumerDef = $container->getDefinition($id); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | foreach ($taggedConsumers as $id => $tags) { |
36 | 36 | $consumerName = $tags[0]['consumer']; |
37 | - $originLogger = $id . '.logger'; |
|
37 | + $originLogger = $id.'.logger'; |
|
38 | 38 | |
39 | 39 | if ($container->hasDefinition($originLogger)) { |
40 | 40 | $consumerDef = $container->getDefinition($id); |
@@ -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 | } |