Passed
Pull Request — master (#417)
by
unknown
01:41
created
src/Picqer/Financials/Exact/Connection.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -186,49 +186,49 @@
 block discarded – undo
186 186
         }
187 187
 
188 188
         // If access token is not set or token has expired, acquire new token
189
-		if (empty($this->accessToken)){
190
-			$this->acquireAccessToken();
191
-		}else if($this->tokenHasExpired()){
192
-			$this->acquireAccessToken_by_refreshtoken();
193
-		}
189
+        if (empty($this->accessToken)){
190
+            $this->acquireAccessToken();
191
+        }else if($this->tokenHasExpired()){
192
+            $this->acquireAccessToken_by_refreshtoken();
193
+        }
194 194
 		
195 195
         $client = $this->client();
196 196
 
197 197
         return $client;
198 198
     }
199 199
 	
200
-	// Acquire AccessToken by RefreshToken
201
-	private function acquireAccessToken_by_refreshtoken() {
202
-		$headers = array("Content-Type: application/x-www-form-urlencoded", "Cache-Control: no-cache");	
203
-		$params = array(
204
-			'refresh_token' => $this->refreshToken,
205
-			'grant_type' => 'refresh_token',
206
-			'client_id'     => $this->exactClientId,
200
+    // Acquire AccessToken by RefreshToken
201
+    private function acquireAccessToken_by_refreshtoken() {
202
+        $headers = array("Content-Type: application/x-www-form-urlencoded", "Cache-Control: no-cache");	
203
+        $params = array(
204
+            'refresh_token' => $this->refreshToken,
205
+            'grant_type' => 'refresh_token',
206
+            'client_id'     => $this->exactClientId,
207 207
             'client_secret' => $this->exactClientSecret,
208
-		);
209
-
210
-		$curl = curl_init();                  
211
-		$url = $this->getTokenUrl();
212
-		curl_setopt($curl, CURLOPT_URL,$url);
213
-		curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);				
214
-		curl_setopt($curl, CURLOPT_POST, true); 
215
-		curl_setopt($curl, CURLOPT_POSTFIELDS,http_build_query($params));
216
-		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
217
-		$output = curl_exec ($curl);
218
-
219
-		$res = json_decode($output, true);
220
-		if(!$res['error'] && $res['refresh_token']){
221
-			$this->accessToken = $res['access_token'];
222
-			$this->refreshToken = $res['refresh_token'];
223
-			$this->tokenExpires = $this->getTimestampFromExpiresIn($res['expires_in']);
224
-
225
-			if (is_callable($this->tokenUpdateCallback)) {
226
-				call_user_func($this->tokenUpdateCallback, $this);
227
-			}
228
-		} else {
229
-			throw new ApiException('Could not acquire tokens, json decode failed. Got response: ' . $res["error"] .', '. $res["error_description"]);
230
-		}
231
-	}
208
+        );
209
+
210
+        $curl = curl_init();                  
211
+        $url = $this->getTokenUrl();
212
+        curl_setopt($curl, CURLOPT_URL,$url);
213
+        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);				
214
+        curl_setopt($curl, CURLOPT_POST, true); 
215
+        curl_setopt($curl, CURLOPT_POSTFIELDS,http_build_query($params));
216
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
217
+        $output = curl_exec ($curl);
218
+
219
+        $res = json_decode($output, true);
220
+        if(!$res['error'] && $res['refresh_token']){
221
+            $this->accessToken = $res['access_token'];
222
+            $this->refreshToken = $res['refresh_token'];
223
+            $this->tokenExpires = $this->getTimestampFromExpiresIn($res['expires_in']);
224
+
225
+            if (is_callable($this->tokenUpdateCallback)) {
226
+                call_user_func($this->tokenUpdateCallback, $this);
227
+            }
228
+        } else {
229
+            throw new ApiException('Could not acquire tokens, json decode failed. Got response: ' . $res["error"] .', '. $res["error_description"]);
230
+        }
231
+    }
232 232
 
233 233
     /**
234 234
      * @param string $method
Please login to merge, or discard this patch.