Passed
Push — develop ( 63c666...4ff015 )
by Pieter van der
16:59
created
library/tiqr/Tiqr/DeviceStorage/TokenExchange.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $url = $this->_options["url"]."?appId=".$this->_options["appid"];
42 42
         
43
-        $url.= "&notificationToken=".$notificationToken;
43
+        $url .= "&notificationToken=".$notificationToken;
44 44
 
45 45
         $ch = curl_init();
46 46
 
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
         $output = curl_exec($ch);
54 54
         curl_close($ch);
55 55
 
56
-        if (stripos($output, "not found")!==false) {
56
+        if (stripos($output, "not found") !== false) {
57 57
             $this->logger->error('Token Exchange failed and responded with: not found', ['full output' => $output]);
58 58
             return false;
59 59
         }
60 60
 
61
-        if (stripos($output, "error")!==false) {
61
+        if (stripos($output, "error") !== false) {
62 62
             $this->logger->error('Token Exchange failed and responded with: error', ['full output' => $output]);
63 63
             return false;
64 64
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/FCM.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * @throws Tiqr_Message_Exception_SendFailure
51 51
      */
52
-    private function getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir )
52
+    private function getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir)
53 53
     {
54 54
         $client = new Google_Client();
55 55
         $client->setLogger($this->logger);
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
             $pool = new FilesystemCachePool($filesystem);
62 62
 
63 63
             //set up a callback to log token refresh
64
-            $logger=$this->logger;
65
-            $tokenCallback = function ($cacheKey, $accessToken) use ($logger) {
64
+            $logger = $this->logger;
65
+            $tokenCallback = function($cacheKey, $accessToken) use ($logger) {
66 66
                 $logger->info(sprintf('New access token received at cache key %s', $cacheKey));
67 67
             };
68 68
             $client->setTokenCallback($tokenCallback);
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
      * @param  $retry           boolean is this a 2nd attempt
95 95
      * @throws Tiqr_Message_Exception_SendFailure
96 96
      */
97
-    private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $cacheTokens, string $tokenCacheDir, bool $retry=false)
97
+    private function _sendFirebase(string $deviceToken, string $alert, string $challenge, string $projectId, string $credentialsFile, bool $cacheTokens, string $tokenCacheDir, bool $retry = false)
98 98
     {
99
-        $apiurl = sprintf('https://fcm.googleapis.com/v1/projects/%s/messages:send',$projectId);
99
+        $apiurl = sprintf('https://fcm.googleapis.com/v1/projects/%s/messages:send', $projectId);
100 100
 
101 101
         $fields = [
102 102
             'message' => [
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         try {
115 115
             $headers = array(
116
-                'Authorization: Bearer ' . $this->getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir),
116
+                'Authorization: Bearer '.$this->getGoogleAccessToken($credentialsFile, $cacheTokens, $tokenCacheDir),
117 117
                 'Content-Type: application/json',
118 118
             );
119 119
         } catch (\Google\Exception $e) {
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
         }
138 138
 
139 139
         if (!empty($errors)) {
140
-            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true);
140
+            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true);
141 141
         }
142 142
 
143 143
         // Wait and retry once in case of a 502 Bad Gateway error
144 144
         if ($statusCode === 502 && !($retry)) {
145 145
             sleep(2);
146
-            $this->_sendFirebase($deviceToken, $alert, $challenge, $projectId, $credentialsFile,  $cacheTokens,  $tokenCacheDir, true);
146
+            $this->_sendFirebase($deviceToken, $alert, $challenge, $projectId, $credentialsFile, $cacheTokens, $tokenCacheDir, true);
147 147
             return;
148 148
         }
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         // handle errors, ignoring registration_id's
155 155
         $response = json_decode($result, true);
156 156
         foreach ($response as $k => $v) {
157
-            if ($k=="error") {
157
+            if ($k == "error") {
158 158
                 throw new Tiqr_Message_Exception_SendFailure(sprintf("Error in FCM response: %s", $result), true);
159 159
             }
160 160
         }
Please login to merge, or discard this patch.