Passed
Pull Request — develop (#52)
by Peter
05:08
created
library/tiqr/Tiqr/Message/FCM.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -113,9 +113,9 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * @throws \Google\Exception
48 48
      */
49
-    private function getGoogleAccessToken($credentialsFile){
49
+    private function getGoogleAccessToken($credentialsFile) {
50 50
         $client = new \Google_Client();
51 51
         $client->setAuthConfig($credentialsFile);
52 52
         $client->addScope('https://www.googleapis.com/auth/firebase.messaging');
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @throws Tiqr_Message_Exception_SendFailure
68 68
      * @throws \Google\Exception
69 69
      */
70
-    private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $retry=false)
70
+    private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $retry = false)
71 71
     {
72 72
         $apiurl = 'https://fcm.googleapis.com/v1/projects/'.$projectId.'/messages:send';
73 73
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         ];
86 86
 
87 87
         $headers = array(
88
-            'Authorization: Bearer ' . $this->getGoogleAccessToken($credentialsFile),
88
+            'Authorization: Bearer '.$this->getGoogleAccessToken($credentialsFile),
89 89
             'Content-Type: application/json',
90 90
         );
91 91
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $result = curl_exec($ch);
99 99
         $errors = curl_error($ch);
100 100
         $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
101
-        $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP);
101
+        $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP);
102 102
         curl_close($ch);
103 103
 
104 104
         if ($result === false) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         }
107 107
 
108 108
         if (!empty($errors)) {
109
-            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true);
109
+            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true);
110 110
         }
111 111
 
112 112
         // Wait and retry once in case of a 502 Bad Gateway error
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         // handle errors, ignoring registration_id's
124 124
         $response = json_decode($result, true);
125 125
         foreach ($response as $k => $v) {
126
-            if ($k=="error") {
126
+            if ($k == "error") {
127 127
                 throw new Tiqr_Message_Exception_SendFailure(sprintf("Error in FCM response: %s", $result), true);
128 128
             }
129 129
         }
Please login to merge, or discard this patch.