@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
277 | - * @return string |
|
277 | + * @return boolean |
|
278 | 278 | */ |
279 | 279 | public function getExchange() |
280 | 280 | { |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
285 | - * @return string |
|
285 | + * @return boolean |
|
286 | 286 | */ |
287 | 287 | public function getType() |
288 | 288 | { |
@@ -15,6 +15,9 @@ discard block |
||
15 | 15 | private $fromName; |
16 | 16 | private $queueName; |
17 | 17 | |
18 | + /** |
|
19 | + * @param string $queueName |
|
20 | + */ |
|
18 | 21 | public function __construct($queueName, ConnectionManager $manager, $fromName = '') |
19 | 22 | { |
20 | 23 | $this->queueName = $queueName; |
@@ -87,7 +90,7 @@ discard block |
||
87 | 90 | } |
88 | 91 | |
89 | 92 | /** |
90 | - * @return string |
|
93 | + * @return boolean |
|
91 | 94 | */ |
92 | 95 | public function getExchange() |
93 | 96 | { |
@@ -95,7 +98,7 @@ discard block |
||
95 | 98 | } |
96 | 99 | |
97 | 100 | /** |
98 | - * @return string |
|
101 | + * @return boolean |
|
99 | 102 | */ |
100 | 103 | public function getExchangeType() |
101 | 104 | { |
@@ -34,13 +34,13 @@ |
||
34 | 34 | { |
35 | 35 | $this->refreshChannel(); |
36 | 36 | |
37 | - if (! $this->queueHasExists()) { |
|
37 | + if (!$this->queueHasExists()) { |
|
38 | 38 | throw new QueueNotFoundException("Queue $this->queueName not declared."); |
39 | 39 | } |
40 | 40 | $queueBag = new WorkerQueueBag($this->getQueueName()); |
41 | 41 | $this->getChannel()->queueDeclare($queueBag->getQueueDeclare()); |
42 | 42 | $msg = new CmobiAMQPMessage( |
43 | - (string) $data, |
|
43 | + (string)$data, |
|
44 | 44 | [ |
45 | 45 | 'delivery_mode' => 2, // make message persistent |
46 | 46 | 'priority' => $priority, |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function toClosure() |
30 | 30 | { |
31 | - return function (AMQPMessage $message) { |
|
31 | + return function(AMQPMessage $message) { |
|
32 | 32 | $this->getQueueService()->handle($message); |
33 | 33 | |
34 | 34 | $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']); |
@@ -129,7 +129,7 @@ |
||
129 | 129 | |
130 | 130 | /** |
131 | 131 | * @param string $msg |
132 | - * @param null $correlationId |
|
132 | + * @param string $correlationId |
|
133 | 133 | * |
134 | 134 | * @return CmobiAMQPMessage |
135 | 135 | */ |
@@ -62,10 +62,10 @@ |
||
62 | 62 | $this->parameters['user'], |
63 | 63 | $this->parameters['password'], |
64 | 64 | $this->parameters['vhost'], |
65 | - false, // insist |
|
65 | + false, // insist |
|
66 | 66 | 'AMQPLAIN', // login_method |
67 | - null, // login_response |
|
68 | - 'en_US', // locale |
|
67 | + null, // login_response |
|
68 | + 'en_US', // locale |
|
69 | 69 | $this->parameters['connection_timeout'], |
70 | 70 | $this->parameters['read_write_timeout'], |
71 | 71 | $this->parameters['ssl_context'], |
@@ -29,11 +29,11 @@ |
||
29 | 29 | */ |
30 | 30 | public function toClosure() |
31 | 31 | { |
32 | - return function (AMQPMessage $message) { |
|
32 | + return function(AMQPMessage $message) { |
|
33 | 33 | $response = $this->getQueueService()->handle($message); |
34 | 34 | |
35 | 35 | $amqpResponse = new CmobiAMQPMessage( |
36 | - (string) $response, |
|
36 | + (string)$response, |
|
37 | 37 | ['correlation_id' => $message->get('correlation_id')] |
38 | 38 | ); |
39 | 39 |
@@ -76,7 +76,7 @@ |
||
76 | 76 | ->disableOriginalConstructor() |
77 | 77 | ->getMock(); |
78 | 78 | $callbackMock->method('toClosure') |
79 | - ->willReturn(function () {}); |
|
79 | + ->willReturn(function() {}); |
|
80 | 80 | |
81 | 81 | return $callbackMock; |
82 | 82 | } |
@@ -17,6 +17,9 @@ |
||
17 | 17 | private $exchange; |
18 | 18 | private $exchangeType; |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $exchange |
|
22 | + */ |
|
20 | 23 | public function __construct( |
21 | 24 | $exchange, |
22 | 25 | $exchangeType = ExchangeType::FANOUT, |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $this->refreshChannel(); |
42 | 42 | $queueBag = new SubscriberQueueBag($this->getExchange(), $this->getExchangeType(), $this->getQueueName()); |
43 | 43 | $this->getChannel()->exchangeDeclare($queueBag->getExchangeDeclare()); |
44 | - $msg = new CmobiAMQPMessage((string) $data); |
|
44 | + $msg = new CmobiAMQPMessage((string)$data); |
|
45 | 45 | $this->getChannel()->basic_publish($msg, $queueBag->getExchange()); |
46 | 46 | |
47 | 47 | $this->getChannel()->close(); |
@@ -19,6 +19,9 @@ discard block |
||
19 | 19 | private $correlationId; |
20 | 20 | private $callbackQueue; |
21 | 21 | |
22 | + /** |
|
23 | + * @param string $queueName |
|
24 | + */ |
|
22 | 25 | public function __construct($queueName, ConnectionManager $manager, $fromName = '') |
23 | 26 | { |
24 | 27 | $this->queueName = $queueName; |
@@ -54,7 +57,7 @@ discard block |
||
54 | 57 | } |
55 | 58 | |
56 | 59 | /** |
57 | - * @param $data |
|
60 | + * @param string $data |
|
58 | 61 | * @param int $expire |
59 | 62 | * @param int $priority |
60 | 63 | * @throws QueueNotFoundException |
@@ -140,7 +143,7 @@ discard block |
||
140 | 143 | /** |
141 | 144 | * @todo unecessary method set, its only exists to run tests whitout stay jailed in infinite while waiting response. |
142 | 145 | * |
143 | - * @param $content |
|
146 | + * @param string $content |
|
144 | 147 | */ |
145 | 148 | public function setResponse($content) |
146 | 149 | { |
@@ -170,7 +173,7 @@ discard block |
||
170 | 173 | } |
171 | 174 | |
172 | 175 | /** |
173 | - * @return string |
|
176 | + * @return boolean |
|
174 | 177 | */ |
175 | 178 | public function getExchange() |
176 | 179 | { |
@@ -178,7 +181,7 @@ discard block |
||
178 | 181 | } |
179 | 182 | |
180 | 183 | /** |
181 | - * @return string |
|
184 | + * @return boolean |
|
182 | 185 | */ |
183 | 186 | public function getExchangeType() |
184 | 187 | { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->refreshChannel(); |
66 | 66 | |
67 | - if (! $this->queueHasExists()) { |
|
67 | + if (!$this->queueHasExists()) { |
|
68 | 68 | throw new QueueNotFoundException("Queue $this->queueName not declared."); |
69 | 69 | } |
70 | 70 | $this->correlationId = $this->generateCorrelationId(); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | [$this, 'onResponse'] |
84 | 84 | ); |
85 | 85 | $msg = new CmobiAMQPMessage( |
86 | - (string) $data, |
|
86 | + (string)$data, |
|
87 | 87 | [ |
88 | 88 | 'correlation_id' => $this->correlationId, |
89 | 89 | 'reply_to' => $this->callbackQueue, |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | $this->getChannel()->basic_publish($msg, '', $this->getQueueName()); |
94 | 94 | |
95 | - while (! $this->response) { |
|
95 | + while (!$this->response) { |
|
96 | 96 | $this->getChannel()->wait(null, 0, ($expire / 1000)); |
97 | 97 | } |
98 | 98 | $this->getChannel()->close(); |