@@ -50,7 +50,7 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $attributes = $this->getQueue($queue)->get_attributes(); |
| 52 | 52 | |
| 53 | - return (int) $attributes->activeMsgNum; |
|
| 53 | + return (int)$attributes->activeMsgNum; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -41,8 +41,9 @@ |
||
| 41 | 41 | if (!$this->keep_alive) { |
| 42 | 42 | $this->curl = curl_init(); |
| 43 | 43 | } else { |
| 44 | - if ($this->curl == NULL) |
|
| 45 | - $this->curl = curl_init(); |
|
| 44 | + if ($this->curl == NULL) { |
|
| 45 | + $this->curl = curl_init(); |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | if ($this->curl == NULL) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } else { |
| 187 | 187 | $msgBody = $message->msgBody; |
| 188 | 188 | } |
| 189 | - $params = array( |
|
| 189 | + $params = array( |
|
| 190 | 190 | 'queueName' => $this->queue_name, |
| 191 | 191 | 'msgBody' => $msgBody, |
| 192 | 192 | 'delaySeconds' => $delayTime |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | 'queueName' => $this->queue_name, |
| 213 | 213 | 'delaySeconds' => $delayTime |
| 214 | 214 | ); |
| 215 | - $n = 1; |
|
| 215 | + $n = 1; |
|
| 216 | 216 | foreach ($messages as $message) { |
| 217 | 217 | $key = 'msgBody.' . $n; |
| 218 | 218 | if ($this->encoding) { |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | foreach ($receipt_handle_list as $receipt_handle) { |
| 325 | 325 | $key = 'receiptHandle.' . $n; |
| 326 | 326 | $params[$key] = $receipt_handle; |
| 327 | - $n += 1; |
|
| 327 | + $n += 1; |
|
| 328 | 328 | } |
| 329 | 329 | $this->cmq_client->batch_delete_message($params); |
| 330 | 330 | } |
@@ -41,12 +41,13 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function set_sign_method($sign_method = 'sha1') |
| 43 | 43 | { |
| 44 | - if ($sign_method == 'sha1' || $sign_method == 'HmacSHA256') |
|
| 45 | - $this->sign_method = 'HmacSHA1'; |
|
| 46 | - elseif ($sign_method == 'sha256') |
|
| 47 | - $this->sign_method = 'HmacSHA256'; |
|
| 48 | - else |
|
| 49 | - throw new CMQClientParameterException('Only support sign method HmasSHA256 or HmacSHA1 . Invalid sign method:' . $sign_method); |
|
| 44 | + if ($sign_method == 'sha1' || $sign_method == 'HmacSHA256') { |
|
| 45 | + $this->sign_method = 'HmacSHA1'; |
|
| 46 | + } elseif ($sign_method == 'sha256') { |
|
| 47 | + $this->sign_method = 'HmacSHA256'; |
|
| 48 | + } else { |
|
| 49 | + throw new CMQClientParameterException('Only support sign method HmasSHA256 or HmacSHA1 . Invalid sign method:' . $sign_method); |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | 52 | } |
| 52 | 53 | |
@@ -94,17 +95,21 @@ discard block |
||
| 94 | 95 | $_params['Action'] = ucfirst($action); |
| 95 | 96 | $_params['RequestClient'] = $this->version; |
| 96 | 97 | |
| 97 | - if (!isset($_params['SecretId'])) |
|
| 98 | - $_params['SecretId'] = $this->secretId; |
|
| 98 | + if (!isset($_params['SecretId'])) { |
|
| 99 | + $_params['SecretId'] = $this->secretId; |
|
| 100 | + } |
|
| 99 | 101 | |
| 100 | - if (!isset($_params['Nonce'])) |
|
| 101 | - $_params['Nonce'] = rand(1, 65535); |
|
| 102 | + if (!isset($_params['Nonce'])) { |
|
| 103 | + $_params['Nonce'] = rand(1, 65535); |
|
| 104 | + } |
|
| 102 | 105 | |
| 103 | - if (!isset($_params['Timestamp'])) |
|
| 104 | - $_params['Timestamp'] = time(); |
|
| 106 | + if (!isset($_params['Timestamp'])) { |
|
| 107 | + $_params['Timestamp'] = time(); |
|
| 108 | + } |
|
| 105 | 109 | |
| 106 | - if (!isset($_params['SignatureMethod'])) |
|
| 107 | - $_params['SignatureMethod'] = $this->sign_method; |
|
| 110 | + if (!isset($_params['SignatureMethod'])) { |
|
| 111 | + $_params['SignatureMethod'] = $this->sign_method; |
|
| 112 | + } |
|
| 108 | 113 | |
| 109 | 114 | $plainText = Signature::makeSignPlainText($_params, |
| 110 | 115 | $this->method, $this->host, $req_inter->uri); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | foreach ($subscription_meta->bindindKey as $tag) { |
| 47 | 47 | $key = 'bindindKey.' . $n; |
| 48 | 48 | $params[$key] = $tag; |
| 49 | - $n += 1; |
|
| 49 | + $n += 1; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | foreach ($subscription_meta->FilterTag as $tag) { |
| 56 | 56 | $key = 'filterTag.' . $n; |
| 57 | 57 | $params[$key] = $tag; |
| 58 | - $n += 1; |
|
| 58 | + $n += 1; |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | $this->cmq_client->create_subscription($params); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | foreach ($subscription_meta->bindindKey as $tag) { |
| 172 | 172 | $key = 'bindindKey.' . $n; |
| 173 | 173 | $params[$key] = $tag; |
| 174 | - $n += 1; |
|
| 174 | + $n += 1; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | foreach ($subscription_meta->FilterTag as $tag) { |
| 181 | 181 | $key = 'filterTag.' . $n; |
| 182 | 182 | $params[$key] = $tag; |
| 183 | - $n += 1; |
|
| 183 | + $n += 1; |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | foreach ($vTagList as $tag) { |
| 148 | 148 | $key = 'msgTag.' . $n; |
| 149 | 149 | $params[$key] = $tag; |
| 150 | - $n += 1; |
|
| 150 | + $n += 1; |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | $msgId = $this->cmq_client->publish_message($params); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | foreach ($vtagList as $tag) { |
| 200 | 200 | $key = 'msgTag.' . $n; |
| 201 | 201 | $params[$key] = $tag; |
| 202 | - $n += 1; |
|
| 202 | + $n += 1; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | $topic = new Account(array_get($config, 'options.topic.host'), $config['secret_id'], $config['secret_key']); |
| 36 | 36 | |
| 37 | - $this->dispatcher->listen(WorkerStopping::class, function () { |
|
| 37 | + $this->dispatcher->listen(WorkerStopping::class, function() { |
|
| 38 | 38 | // |
| 39 | 39 | }); |
| 40 | 40 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | /** @var QueueManager $queue */ |
| 31 | 31 | $queue = $this->app['queue']; |
| 32 | 32 | |
| 33 | - $queue->addConnector('cmq', function () { |
|
| 33 | + $queue->addConnector('cmq', function() { |
|
| 34 | 34 | return new CMQConnector($this->app['events']); |
| 35 | 35 | }); |
| 36 | 36 | } |