@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->_sendFirebase($translatedAddress, $alertText, $url, $apiKey); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - private function getGoogleAccessToken(){ |
|
| 44 | + private function getGoogleAccessToken() { |
|
| 45 | 45 | |
| 46 | 46 | $credentialsFilePath = './google-api.json'; |
| 47 | 47 | $client = new \Google_Client(); |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @throws Tiqr_Message_Exception_SendFailure |
| 66 | 66 | */ |
| 67 | - private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry=false) |
|
| 67 | + private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry = false) |
|
| 68 | 68 | { |
| 69 | - $apiurl = 'https://fcm.googleapis.com/v1/projects/your-project-id/messages:send'; //replace "your-project-id" with...your project ID |
|
| 69 | + $apiurl = 'https://fcm.googleapis.com/v1/projects/your-project-id/messages:send'; //replace "your-project-id" with...your project ID |
|
| 70 | 70 | |
| 71 | 71 | $fields = [ |
| 72 | 72 | 'message' => [ |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ]; |
| 80 | 80 | |
| 81 | 81 | $headers = array( |
| 82 | - 'Authorization: Bearer ' . $this->getGoogleAccessToken(), |
|
| 82 | + 'Authorization: Bearer '.$this->getGoogleAccessToken(), |
|
| 83 | 83 | 'Content-Type: application/json', |
| 84 | 84 | ); |
| 85 | 85 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $result = curl_exec($ch); |
| 93 | 93 | $errors = curl_error($ch); |
| 94 | 94 | $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 95 | - $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP); |
|
| 95 | + $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP); |
|
| 96 | 96 | curl_close($ch); |
| 97 | 97 | |
| 98 | 98 | if ($result === false) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if (!empty($errors)) { |
| 103 | - throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true); |
|
| 103 | + throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Wait and retry once in case of a 502 Bad Gateway error |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $response = json_decode($result, true); |
| 119 | 119 | foreach ($response['results'] as $k => $v) { |
| 120 | 120 | if (isset($v['error'])) { |
| 121 | - throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: " . $v['error'], true); |
|
| 121 | + throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: ".$v['error'], true); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |