@@ -113,9 +113,9 @@ |
||
| 113 | 113 | |
| 114 | 114 | // Wait and retry once in case of a 502 Bad Gateway error |
| 115 | 115 | if ($statusCode === 502 && !($retry)) { |
| 116 | - sleep(2); |
|
| 117 | - $this->_sendFirebase($deviceToken, $alert, $challenge, $projectId, $credentialsFile, true); |
|
| 118 | - return; |
|
| 116 | + sleep(2); |
|
| 117 | + $this->_sendFirebase($deviceToken, $alert, $challenge, $projectId, $credentialsFile, true); |
|
| 118 | + return; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if ($statusCode !== 200) { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @throws \Google\Exception |
| 48 | 48 | */ |
| 49 | - private function getGoogleAccessToken($credentialsFile){ |
|
| 49 | + private function getGoogleAccessToken($credentialsFile) { |
|
| 50 | 50 | $options = $this->getOptions(); |
| 51 | 51 | $client = new \Google_Client(); |
| 52 | 52 | $client->setAuthConfig($credentialsFile); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @throws Tiqr_Message_Exception_SendFailure |
| 69 | 69 | * @throws \Google\Exception |
| 70 | 70 | */ |
| 71 | - private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $retry=false) |
|
| 71 | + private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $retry = false) |
|
| 72 | 72 | { |
| 73 | 73 | $options = $this->getOptions(); |
| 74 | 74 | $apiurl = 'https://fcm.googleapis.com/v1/projects/'.$projectId.'/messages:send'; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ]; |
| 88 | 88 | |
| 89 | 89 | $headers = array( |
| 90 | - 'Authorization: Bearer ' . $this->getGoogleAccessToken($credentialsFile), |
|
| 90 | + 'Authorization: Bearer '.$this->getGoogleAccessToken($credentialsFile), |
|
| 91 | 91 | 'Content-Type: application/json', |
| 92 | 92 | ); |
| 93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $result = curl_exec($ch); |
| 101 | 101 | $errors = curl_error($ch); |
| 102 | 102 | $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 103 | - $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP); |
|
| 103 | + $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP); |
|
| 104 | 104 | curl_close($ch); |
| 105 | 105 | |
| 106 | 106 | if ($result === false) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | if (!empty($errors)) { |
| 111 | - throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true); |
|
| 111 | + throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Wait and retry once in case of a 502 Bad Gateway error |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $response = json_decode($result, true); |
| 127 | 127 | foreach ($response['results'] as $k => $v) { |
| 128 | 128 | if (isset($v['error'])) { |
| 129 | - throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: " . $v['error'], true); |
|
| 129 | + throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: ".$v['error'], true); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |