@@ -310,14 +310,14 @@ discard block |
||
| 310 | 310 | { |
| 311 | 311 | $this->amqpChannel->expects($this->any()) |
| 312 | 312 | ->method('basic_reject') |
| 313 | - ->will($this->returnCallback(function ($delivery_tag, $requeue) use ($expectedMethod, $expectedRequeue) { |
|
| 313 | + ->will($this->returnCallback(function($delivery_tag, $requeue) use ($expectedMethod, $expectedRequeue) { |
|
| 314 | 314 | Assert::assertSame($expectedMethod, 'basic_reject'); // Check if this function should be called. |
| 315 | 315 | Assert::assertSame($requeue, $expectedRequeue); // Check if the message should be requeued. |
| 316 | 316 | })); |
| 317 | 317 | |
| 318 | 318 | $this->amqpChannel->expects($this->any()) |
| 319 | 319 | ->method('basic_ack') |
| 320 | - ->will($this->returnCallback(function ($delivery_tag) use ($expectedMethod) { |
|
| 320 | + ->will($this->returnCallback(function($delivery_tag) use ($expectedMethod) { |
|
| 321 | 321 | Assert::assertSame($expectedMethod, 'basic_ack'); // Check if this function should be called. |
| 322 | 322 | })); |
| 323 | 323 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | private function prepareCallback(?int $processFlag) |
| 331 | 331 | { |
| 332 | - return function ($msg) use ($processFlag) { |
|
| 332 | + return function($msg) use ($processFlag) { |
|
| 333 | 333 | return $processFlag; |
| 334 | 334 | }; |
| 335 | 335 | } |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | $this->assertInstanceOf('OldSound\RabbitMqBundle\Tests\RabbitMq\Fixtures\AMQPConnection', $instance); |
| 24 | 24 | $this->assertEquals(array( |
| 25 | 25 | 'localhost', // host |
| 26 | - 5672, // port |
|
| 27 | - 'guest', // user |
|
| 28 | - 'guest', // password |
|
| 29 | - '/', // vhost |
|
| 30 | - false, // insist |
|
| 31 | - "AMQPLAIN", // login method |
|
| 32 | - null, // login response |
|
| 33 | - "en_US", // locale |
|
| 34 | - 3, // connection timeout |
|
| 35 | - 3, // read write timeout |
|
| 36 | - null, // context |
|
| 37 | - false, // keepalive |
|
| 38 | - 0, // heartbeat |
|
| 26 | + 5672, // port |
|
| 27 | + 'guest', // user |
|
| 28 | + 'guest', // password |
|
| 29 | + '/', // vhost |
|
| 30 | + false, // insist |
|
| 31 | + "AMQPLAIN", // login method |
|
| 32 | + null, // login response |
|
| 33 | + "en_US", // locale |
|
| 34 | + 3, // connection timeout |
|
| 35 | + 3, // read write timeout |
|
| 36 | + null, // context |
|
| 37 | + false, // keepalive |
|
| 38 | + 0, // heartbeat |
|
| 39 | 39 | ), $instance->constructParams); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -51,18 +51,18 @@ discard block |
||
| 51 | 51 | $this->assertInstanceOf('PhpAmqpLib\Connection\AMQPSocketConnection', $instance); |
| 52 | 52 | $this->assertEquals(array( |
| 53 | 53 | 'localhost', // host |
| 54 | - 5672, // port |
|
| 55 | - 'guest', // user |
|
| 56 | - 'guest', // password |
|
| 57 | - '/', // vhost |
|
| 58 | - false, // insist |
|
| 59 | - "AMQPLAIN", // login method |
|
| 60 | - null, // login response |
|
| 61 | - "en_US", // locale |
|
| 62 | - 3, // read_timeout |
|
| 63 | - false, // keepalive |
|
| 64 | - 3, // write_timeout |
|
| 65 | - 0, // heartbeat |
|
| 54 | + 5672, // port |
|
| 55 | + 'guest', // user |
|
| 56 | + 'guest', // password |
|
| 57 | + '/', // vhost |
|
| 58 | + false, // insist |
|
| 59 | + "AMQPLAIN", // login method |
|
| 60 | + null, // login response |
|
| 61 | + "en_US", // locale |
|
| 62 | + 3, // read_timeout |
|
| 63 | + false, // keepalive |
|
| 64 | + 3, // write_timeout |
|
| 65 | + 0, // heartbeat |
|
| 66 | 66 | ), $instance->constructParams); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -81,18 +81,18 @@ discard block |
||
| 81 | 81 | $this->assertInstanceOf('PhpAmqpLib\Connection\AMQPSocketConnection', $instance); |
| 82 | 82 | $this->assertEquals(array( |
| 83 | 83 | 'localhost', // host |
| 84 | - 5672, // port |
|
| 85 | - 'guest', // user |
|
| 86 | - 'guest', // password |
|
| 87 | - '/', // vhost |
|
| 88 | - false, // insist |
|
| 89 | - "AMQPLAIN", // login method |
|
| 90 | - null, // login response |
|
| 91 | - "en_US", // locale |
|
| 92 | - 31, // read_timeout |
|
| 93 | - false, // keepalive |
|
| 94 | - 32, // write_timeout |
|
| 95 | - 0, // heartbeat |
|
| 84 | + 5672, // port |
|
| 85 | + 'guest', // user |
|
| 86 | + 'guest', // password |
|
| 87 | + '/', // vhost |
|
| 88 | + false, // insist |
|
| 89 | + "AMQPLAIN", // login method |
|
| 90 | + null, // login response |
|
| 91 | + "en_US", // locale |
|
| 92 | + 31, // read_timeout |
|
| 93 | + false, // keepalive |
|
| 94 | + 32, // write_timeout |
|
| 95 | + 0, // heartbeat |
|
| 96 | 96 | ), $instance->constructParams); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -113,20 +113,20 @@ discard block |
||
| 113 | 113 | $instance = $factory->createConnection(); |
| 114 | 114 | $this->assertInstanceOf('OldSound\RabbitMqBundle\Tests\RabbitMq\Fixtures\AMQPConnection', $instance); |
| 115 | 115 | $this->assertEquals(array( |
| 116 | - 'foo_host', // host |
|
| 117 | - 123, // port |
|
| 118 | - 'foo_user', // user |
|
| 116 | + 'foo_host', // host |
|
| 117 | + 123, // port |
|
| 118 | + 'foo_user', // user |
|
| 119 | 119 | 'foo_password', // password |
| 120 | - '/vhost', // vhost |
|
| 121 | - false, // insist |
|
| 122 | - "AMQPLAIN", // login method |
|
| 123 | - null, // login response |
|
| 124 | - "en_US", // locale |
|
| 125 | - 3, // connection timeout |
|
| 126 | - 3, // read write timeout |
|
| 127 | - null, // context |
|
| 128 | - false, // keepalive |
|
| 129 | - 0, // heartbeat |
|
| 120 | + '/vhost', // vhost |
|
| 121 | + false, // insist |
|
| 122 | + "AMQPLAIN", // login method |
|
| 123 | + null, // login response |
|
| 124 | + "en_US", // locale |
|
| 125 | + 3, // connection timeout |
|
| 126 | + 3, // read write timeout |
|
| 127 | + null, // context |
|
| 128 | + false, // keepalive |
|
| 129 | + 0, // heartbeat |
|
| 130 | 130 | ), $instance->constructParams); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -148,20 +148,20 @@ discard block |
||
| 148 | 148 | $instance = $factory->createConnection(); |
| 149 | 149 | $this->assertInstanceOf('OldSound\RabbitMqBundle\Tests\RabbitMq\Fixtures\AMQPConnection', $instance); |
| 150 | 150 | $this->assertEquals(array( |
| 151 | - 'bar_host', // host |
|
| 152 | - 321, // port |
|
| 153 | - 'bar_user', // user |
|
| 151 | + 'bar_host', // host |
|
| 152 | + 321, // port |
|
| 153 | + 'bar_user', // user |
|
| 154 | 154 | 'bar_password', // password |
| 155 | - 'whost', // vhost |
|
| 156 | - false, // insist |
|
| 157 | - "AMQPLAIN", // login method |
|
| 158 | - null, // login response |
|
| 159 | - "en_US", // locale |
|
| 160 | - 6, // connection timeout |
|
| 161 | - 6, // read write timeout |
|
| 162 | - null, // context |
|
| 163 | - true, // keepalive |
|
| 164 | - 0, // heartbeat |
|
| 155 | + 'whost', // vhost |
|
| 156 | + false, // insist |
|
| 157 | + "AMQPLAIN", // login method |
|
| 158 | + null, // login response |
|
| 159 | + "en_US", // locale |
|
| 160 | + 6, // connection timeout |
|
| 161 | + 6, // read write timeout |
|
| 162 | + null, // context |
|
| 163 | + true, // keepalive |
|
| 164 | + 0, // heartbeat |
|
| 165 | 165 | ), $instance->constructParams); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -178,20 +178,20 @@ discard block |
||
| 178 | 178 | $instance = $factory->createConnection(); |
| 179 | 179 | $this->assertInstanceOf('OldSound\RabbitMqBundle\Tests\RabbitMq\Fixtures\AMQPConnection', $instance); |
| 180 | 180 | $this->assertEquals(array( |
| 181 | - 'hoast', // host |
|
| 182 | - 10000, // port |
|
| 183 | - 'usera', // user |
|
| 184 | - 'apass', // password |
|
| 185 | - 'v/host', // vhost |
|
| 186 | - false, // insist |
|
| 187 | - "AMQPLAIN", // login method |
|
| 188 | - null, // login response |
|
| 189 | - "en_US", // locale |
|
| 190 | - 6, // connection timeout |
|
| 191 | - 6, // read write timeout |
|
| 192 | - null, // context |
|
| 193 | - true, // keepalive |
|
| 194 | - 0, // heartbeat |
|
| 181 | + 'hoast', // host |
|
| 182 | + 10000, // port |
|
| 183 | + 'usera', // user |
|
| 184 | + 'apass', // password |
|
| 185 | + 'v/host', // vhost |
|
| 186 | + false, // insist |
|
| 187 | + "AMQPLAIN", // login method |
|
| 188 | + null, // login response |
|
| 189 | + "en_US", // locale |
|
| 190 | + 6, // connection timeout |
|
| 191 | + 6, // read write timeout |
|
| 192 | + null, // context |
|
| 193 | + true, // keepalive |
|
| 194 | + 0, // heartbeat |
|
| 195 | 195 | ), $instance->constructParams); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -208,20 +208,20 @@ discard block |
||
| 208 | 208 | $instance = $factory->createConnection(); |
| 209 | 209 | $this->assertInstanceOf('OldSound\RabbitMqBundle\Tests\RabbitMq\Fixtures\AMQPConnection', $instance); |
| 210 | 210 | $this->assertEquals(array( |
| 211 | - 'host', // host |
|
| 212 | - 321, // port |
|
| 213 | - 'user', // user |
|
| 214 | - 'pass', // password |
|
| 215 | - '', // vhost |
|
| 216 | - false, // insist |
|
| 211 | + 'host', // host |
|
| 212 | + 321, // port |
|
| 213 | + 'user', // user |
|
| 214 | + 'pass', // password |
|
| 215 | + '', // vhost |
|
| 216 | + false, // insist |
|
| 217 | 217 | "AMQPLAIN", // login method |
| 218 | - null, // login response |
|
| 219 | - "en_US", // locale |
|
| 220 | - 6, // connection timeout |
|
| 221 | - 6, // read write timeout |
|
| 222 | - null, // context |
|
| 223 | - true, // keepalive |
|
| 224 | - 0, // heartbeat |
|
| 218 | + null, // login response |
|
| 219 | + "en_US", // locale |
|
| 220 | + 6, // connection timeout |
|
| 221 | + 6, // read write timeout |
|
| 222 | + null, // context |
|
| 223 | + true, // keepalive |
|
| 224 | + 0, // heartbeat |
|
| 225 | 225 | ), $instance->constructParams); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -254,19 +254,19 @@ discard block |
||
| 254 | 254 | $this->assertEquals(array('ssl' => array('verify_peer' => false)), $options); |
| 255 | 255 | $this->assertEquals(array( |
| 256 | 256 | 'ssl_host', // host |
| 257 | - 123, // port |
|
| 257 | + 123, // port |
|
| 258 | 258 | 'ssl_user', // user |
| 259 | 259 | 'ssl_password', // password |
| 260 | - '/ssl', // vhost |
|
| 261 | - false, // insist |
|
| 262 | - "AMQPLAIN", // login method |
|
| 263 | - null, // login response |
|
| 264 | - "en_US", // locale |
|
| 265 | - 3, // connection timeout |
|
| 266 | - 3, // read write timeout |
|
| 267 | - null, // context checked earlier |
|
| 268 | - false, // keepalive |
|
| 269 | - 0, // heartbeat |
|
| 260 | + '/ssl', // vhost |
|
| 261 | + false, // insist |
|
| 262 | + "AMQPLAIN", // login method |
|
| 263 | + null, // login response |
|
| 264 | + "en_US", // locale |
|
| 265 | + 3, // connection timeout |
|
| 266 | + 3, // read write timeout |
|
| 267 | + null, // context checked earlier |
|
| 268 | + false, // keepalive |
|
| 269 | + 0, // heartbeat |
|
| 270 | 270 | ), $instance->constructParams); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | ->method('getConnectionParameters') |
| 278 | 278 | ->will($this->returnValue( |
| 279 | 279 | array( |
| 280 | - 'constructor_args' => array(1,2,3,4) |
|
| 280 | + 'constructor_args' => array(1, 2, 3, 4) |
|
| 281 | 281 | ) |
| 282 | 282 | )); |
| 283 | 283 | $factory = new AMQPConnectionFactory( |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | /** @var AMQPConnection $instance */ |
| 290 | 290 | $instance = $factory->createConnection(); |
| 291 | 291 | $this->assertInstanceOf('OldSound\RabbitMqBundle\Tests\RabbitMq\Fixtures\AMQPConnection', $instance); |
| 292 | - $this->assertEquals(array(1,2,3,4), $instance->constructParams); |
|
| 292 | + $this->assertEquals(array(1, 2, 3, 4), $instance->constructParams); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | public function testConnectionsParametersProvider(): void |
@@ -316,20 +316,20 @@ discard block |
||
| 316 | 316 | $instance = $factory->createConnection(); |
| 317 | 317 | $this->assertInstanceOf('OldSound\RabbitMqBundle\Tests\RabbitMq\Fixtures\AMQPConnection', $instance); |
| 318 | 318 | $this->assertEquals(array( |
| 319 | - '1.2.3.4', // host |
|
| 320 | - 5678, // port |
|
| 321 | - 'admin', // user |
|
| 322 | - 'admin', // password |
|
| 323 | - 'foo', // vhost |
|
| 324 | - false, // insist |
|
| 325 | - "AMQPLAIN", // login method |
|
| 326 | - null, // login response |
|
| 327 | - "en_US", // locale |
|
| 328 | - 3, // connection timeout |
|
| 329 | - 3, // read write timeout |
|
| 330 | - null, // context |
|
| 331 | - false, // keepalive |
|
| 332 | - 0, // heartbeat |
|
| 319 | + '1.2.3.4', // host |
|
| 320 | + 5678, // port |
|
| 321 | + 'admin', // user |
|
| 322 | + 'admin', // password |
|
| 323 | + 'foo', // vhost |
|
| 324 | + false, // insist |
|
| 325 | + "AMQPLAIN", // login method |
|
| 326 | + null, // login response |
|
| 327 | + "en_US", // locale |
|
| 328 | + 3, // connection timeout |
|
| 329 | + 3, // read write timeout |
|
| 330 | + null, // context |
|
| 331 | + false, // keepalive |
|
| 332 | + 0, // heartbeat |
|
| 333 | 333 | ), $instance->constructParams); |
| 334 | 334 | } |
| 335 | 335 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | //PHP 5.3 Compliant |
| 62 | 62 | $currentObject = $this; |
| 63 | 63 | |
| 64 | - $this->getChannel()->basic_consume($name, $this->getQueueConsumerTag($name), false, false, false, false, function (AMQPMessage $msg) use($currentObject, $name) { |
|
| 64 | + $this->getChannel()->basic_consume($name, $this->getQueueConsumerTag($name), false, false, false, false, function(AMQPMessage $msg) use($currentObject, $name) { |
|
| 65 | 65 | $currentObject->processQueueMessage($name, $msg); |
| 66 | 66 | }); |
| 67 | 67 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | protected function queueDeclare(): void |
| 71 | 71 | { |
| 72 | 72 | foreach ($this->queues as $name => $options) { |
| 73 | - list($queueName, ,) = $this->getChannel()->queue_declare( |
|
| 73 | + list($queueName,,) = $this->getChannel()->queue_declare( |
|
| 74 | 74 | $name, $options['passive'], |
| 75 | 75 | $options['durable'], $options['exclusive'], |
| 76 | 76 | $options['auto_delete'], $options['nowait'], |
@@ -263,7 +263,7 @@ |
||
| 263 | 263 | private function addMessage(AMQPMessage $message): void |
| 264 | 264 | { |
| 265 | 265 | $this->batchCounter++; |
| 266 | - $this->messages[(int)$message->delivery_info['delivery_tag']] = $message; |
|
| 266 | + $this->messages[(int) $message->delivery_info['delivery_tag']] = $message; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | private function getMessage(int $deliveryTag): ?AMQPMessage |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | public function initServer(string $name): void |
| 13 | 13 | { |
| 14 | 14 | $this->setExchangeOptions(array('name' => $name, 'type' => 'direct')); |
| 15 | - $this->setQueueOptions(array('name' => $name . '-queue')); |
|
| 15 | + $this->setQueueOptions(array('name' => $name.'-queue')); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function processMessage(AMQPMessage $msg): void |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $this->consumed++; |
| 26 | 26 | $this->maybeStopConsumer(); |
| 27 | 27 | } catch (\Exception $e) { |
| 28 | - $this->sendReply('error: ' . $e->getMessage(), $msg->get('reply_to'), $msg->get('correlation_id')); |
|
| 28 | + $this->sendReply('error: '.$e->getMessage(), $msg->get('reply_to'), $msg->get('correlation_id')); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | /** |
| 44 | 44 | * @throws \ErrorException |
| 45 | 45 | */ |
| 46 | - public function start (int $msgAmount = 0): void |
|
| 46 | + public function start(int $msgAmount = 0): void |
|
| 47 | 47 | { |
| 48 | 48 | $this->target = $msgAmount; |
| 49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | ? 'amq.rabbitmq.reply-to' // On direct reply-to mode, use predefined queue name |
| 52 | 52 | : $this->getQueueName(), |
| 53 | 53 | 'delivery_mode' => 1, // non durable |
| 54 | - 'expiration' => $expiration*1000, |
|
| 54 | + 'expiration' => $expiration * 1000, |
|
| 55 | 55 | 'correlation_id' => $requestId)); |
| 56 | 56 | |
| 57 | 57 | $this->getChannel()->basic_publish($msg, $server, $routingKey); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | protected function getQueueName(): ?string |
| 103 | 103 | { |
| 104 | 104 | if (null === $this->queueName) { |
| 105 | - list($this->queueName, ,) = $this->getChannel()->queue_declare("", false, false, true, false); |
|
| 105 | + list($this->queueName,,) = $this->getChannel()->queue_declare("", false, false, true, false); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $this->queueName; |
@@ -207,7 +207,7 @@ |
||
| 207 | 207 | protected function queueDeclare(): void |
| 208 | 208 | { |
| 209 | 209 | if ($this->queueOptions['declare']) { |
| 210 | - list($queueName, ,) = $this->getChannel()->queue_declare($this->queueOptions['name'], $this->queueOptions['passive'], |
|
| 210 | + list($queueName,,) = $this->getChannel()->queue_declare($this->queueOptions['name'], $this->queueOptions['passive'], |
|
| 211 | 211 | $this->queueOptions['durable'], $this->queueOptions['exclusive'], |
| 212 | 212 | $this->queueOptions['auto_delete'], $this->queueOptions['nowait'], |
| 213 | 213 | $this->queueOptions['arguments'], $this->queueOptions['ticket']); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | $this->initConsumer($input); |
| 102 | 102 | |
| 103 | - return $this->consumer->consume((int)$this->amount); |
|
| 103 | + return $this->consumer->consume((int) $this->amount); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | protected function initConsumer(InputInterface $input): void |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $this->consumer = $this->getContainer() |
| 109 | 109 | ->get(sprintf($this->getConsumerService(), $input->getArgument('name'))); |
| 110 | 110 | |
| 111 | - if (!is_null($input->getOption('memory-limit')) && ctype_digit((string) $input->getOption('memory-limit')) && (int)$input->getOption('memory-limit') > 0) { |
|
| 111 | + if (!is_null($input->getOption('memory-limit')) && ctype_digit((string) $input->getOption('memory-limit')) && (int) $input->getOption('memory-limit') > 0) { |
|
| 112 | 112 | $this->consumer->setMemoryLimit($input->getOption('memory-limit')); |
| 113 | 113 | } |
| 114 | 114 | $this->consumer->setRoutingKey($input->getOption('route')); |