Passed
Pull Request — develop (#52)
by Peter
11:25
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
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.