@@ -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) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @throws \Google\Exception |
51 | 51 | */ |
52 | - private function getGoogleAccessToken($credentialsFile){ |
|
52 | + private function getGoogleAccessToken($credentialsFile) { |
|
53 | 53 | $filesystemAdapter = new Local(__DIR__.'/'); |
54 | 54 | $filesystem = new Filesystem($filesystemAdapter); |
55 | 55 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @throws Tiqr_Message_Exception_SendFailure |
77 | 77 | * @throws \Google\Exception |
78 | 78 | */ |
79 | - private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $retry=false) |
|
79 | + private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $retry = false) |
|
80 | 80 | { |
81 | 81 | $apiurl = 'https://fcm.googleapis.com/v1/projects/'.$projectId.'/messages:send'; |
82 | 82 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ]; |
95 | 95 | |
96 | 96 | $headers = array( |
97 | - 'Authorization: Bearer ' . $this->getGoogleAccessToken($credentialsFile), |
|
97 | + 'Authorization: Bearer '.$this->getGoogleAccessToken($credentialsFile), |
|
98 | 98 | 'Content-Type: application/json', |
99 | 99 | ); |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $result = curl_exec($ch); |
108 | 108 | $errors = curl_error($ch); |
109 | 109 | $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
110 | - $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP); |
|
110 | + $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP); |
|
111 | 111 | curl_close($ch); |
112 | 112 | |
113 | 113 | if ($result === false) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!empty($errors)) { |
118 | - throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true); |
|
118 | + throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // Wait and retry once in case of a 502 Bad Gateway error |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // handle errors, ignoring registration_id's |
133 | 133 | $response = json_decode($result, true); |
134 | 134 | foreach ($response as $k => $v) { |
135 | - if ($k=="error") { |
|
135 | + if ($k == "error") { |
|
136 | 136 | throw new Tiqr_Message_Exception_SendFailure(sprintf("Error in FCM response: %s", $result), true); |
137 | 137 | } |
138 | 138 | } |