@@ -24,6 +24,10 @@ discard block |
||
| 24 | 24 | private $correlationId; |
| 25 | 25 | private $callbackQueue; |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $queueName |
|
| 29 | + * @param string $fromName |
|
| 30 | + */ |
|
| 27 | 31 | public function __construct($queueName, ConnectionManager $manager, $fromName, $connectionName = 'default') |
| 28 | 32 | { |
| 29 | 33 | $this->connectionName = $connectionName; |
@@ -71,7 +75,7 @@ discard block |
||
| 71 | 75 | } |
| 72 | 76 | |
| 73 | 77 | /** |
| 74 | - * @param $data |
|
| 78 | + * @param string $data |
|
| 75 | 79 | * @param int $expire |
| 76 | 80 | * @param int $priority |
| 77 | 81 | * @throws QueueNotFoundException |
@@ -150,7 +154,7 @@ discard block |
||
| 150 | 154 | /** |
| 151 | 155 | * @todo unecessary method set, its only exists to run tests whitout stay jailed in infinite while waiting response. |
| 152 | 156 | * |
| 153 | - * @param $content |
|
| 157 | + * @param string $content |
|
| 154 | 158 | */ |
| 155 | 159 | public function setResponse($content) |
| 156 | 160 | { |
@@ -180,7 +184,7 @@ discard block |
||
| 180 | 184 | } |
| 181 | 185 | |
| 182 | 186 | /** |
| 183 | - * @return string |
|
| 187 | + * @return boolean |
|
| 184 | 188 | */ |
| 185 | 189 | public function getExchange() |
| 186 | 190 | { |
@@ -188,7 +192,7 @@ discard block |
||
| 188 | 192 | } |
| 189 | 193 | |
| 190 | 194 | /** |
| 191 | - * @return string |
|
| 195 | + * @return boolean |
|
| 192 | 196 | */ |
| 193 | 197 | public function getExchangeType() |
| 194 | 198 | { |
@@ -205,8 +209,8 @@ discard block |
||
| 205 | 209 | |
| 206 | 210 | /** |
| 207 | 211 | * @param CmobiAMQPConnectionInterface $connection |
| 208 | - * @param $expire |
|
| 209 | - * @param $sufix |
|
| 212 | + * @param integer $expire |
|
| 213 | + * @param string $sufix |
|
| 210 | 214 | * @param $corralationId |
| 211 | 215 | * @return CmobiAMQPConnectionInterface |
| 212 | 216 | */ |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | $connection = $this->connectionManager->getConnection($this->connectionName); |
| 84 | 84 | $channel = $connection->channel(); |
| 85 | 85 | |
| 86 | - if (! $this->queueHasExists($channel)) { |
|
| 86 | + if (!$this->queueHasExists($channel)) { |
|
| 87 | 87 | throw new QueueNotFoundException("Queue $this->queueName not declared."); |
| 88 | 88 | } |
| 89 | - $sufix = Uuid::uuid4()->toString() . microtime(); |
|
| 89 | + $sufix = Uuid::uuid4()->toString().microtime(); |
|
| 90 | 90 | $this->createCallbackQueue($channel, $expire, $sufix); |
| 91 | 91 | $msg = new CmobiAMQPMessage( |
| 92 | - (string) $data, |
|
| 92 | + (string)$data, |
|
| 93 | 93 | [ |
| 94 | 94 | 'correlation_id' => $this->correlationId, |
| 95 | 95 | 'reply_to' => $this->callbackQueue, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ); |
| 99 | 99 | $channel->basic_publish($msg, '', $this->getQueueName()); |
| 100 | 100 | |
| 101 | - while (! $this->response) { |
|
| 101 | + while (!$this->response) { |
|
| 102 | 102 | try { |
| 103 | 103 | $channel->wait(null, 0, ($expire / 1000)); |
| 104 | 104 | } catch (\Exception $e) { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** @return string */ |
| 169 | 169 | public function generateCorrelationId() |
| 170 | 170 | { |
| 171 | - return uniqid($this->getQueueName()) . Uuid::uuid4()->toString() . microtime(); |
|
| 171 | + return uniqid($this->getQueueName()).Uuid::uuid4()->toString().microtime(); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -215,16 +215,16 @@ discard block |
||
| 215 | 215 | try { |
| 216 | 216 | $connection->close(); |
| 217 | 217 | sleep(2); |
| 218 | - fwrite($this->logOutput, 'start RpcClient::forceReconnect() - trying connect...' . PHP_EOL); |
|
| 218 | + fwrite($this->logOutput, 'start RpcClient::forceReconnect() - trying connect...'.PHP_EOL); |
|
| 219 | 219 | $connection = $this->getConnectionManager()->getConnection($this->connectionName); |
| 220 | 220 | $channel = $connection->channel(); |
| 221 | 221 | $this->createCallbackQueue($channel, $expire, $sufix, $corralationId); |
| 222 | 222 | } catch (\Exception $e) { |
| 223 | - fwrite($this->errOutput, 'failed RpcClient::forceReconnect() - ' . $e->getMessage() . PHP_EOL); |
|
| 223 | + fwrite($this->errOutput, 'failed RpcClient::forceReconnect() - '.$e->getMessage().PHP_EOL); |
|
| 224 | 224 | |
| 225 | 225 | return $connection; |
| 226 | 226 | } |
| 227 | - fwrite($this->logOutput, 'RpcClient::forceReconnect() - connected!' . PHP_EOL); |
|
| 227 | + fwrite($this->logOutput, 'RpcClient::forceReconnect() - connected!'.PHP_EOL); |
|
| 228 | 228 | |
| 229 | 229 | return $connection; |
| 230 | 230 | } |