@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | $this->clientId = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key'); |
250 | 250 | $this->clientSecret = $this->config->filter('keys')->get('secret'); |
251 | 251 | |
252 | - if (!$this->clientId || !$this->clientSecret) { |
|
252 | + if ( ! $this->clientId || ! $this->clientSecret) { |
|
253 | 253 | throw new InvalidApplicationCredentialsException( |
254 | - 'Your application id is required in order to connect to ' . $this->providerId |
|
254 | + 'Your application id is required in order to connect to '.$this->providerId |
|
255 | 255 | ); |
256 | 256 | } |
257 | 257 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | ]; |
290 | 290 | |
291 | 291 | $refreshToken = $this->getStoredData('refresh_token'); |
292 | - if (!empty($refreshToken)) { |
|
292 | + if ( ! empty($refreshToken)) { |
|
293 | 293 | $this->tokenRefreshParameters = [ |
294 | 294 | 'grant_type' => 'refresh_token', |
295 | 295 | 'refresh_token' => $refreshToken, |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | $this->apiRequestHeaders = [ |
300 | - 'Authorization' => 'Bearer ' . $this->getStoredData('access_token') |
|
300 | + 'Authorization' => 'Bearer '.$this->getStoredData('access_token') |
|
301 | 301 | ]; |
302 | 302 | } |
303 | 303 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | */ |
337 | 337 | public function isConnected() |
338 | 338 | { |
339 | - if ((bool)$this->getStoredData('access_token')) { |
|
340 | - return (!$this->hasAccessTokenExpired() || $this->isRefreshTokenAvailable()); |
|
339 | + if ((bool) $this->getStoredData('access_token')) { |
|
340 | + return ( ! $this->hasAccessTokenExpired() || $this->isRefreshTokenAvailable()); |
|
341 | 341 | } |
342 | 342 | return false; |
343 | 343 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | { |
369 | 369 | $error = filter_input(INPUT_GET, 'error', FILTER_SANITIZE_SPECIAL_CHARS); |
370 | 370 | |
371 | - if (!empty($error)) { |
|
371 | + if ( ! empty($error)) { |
|
372 | 372 | $error_description = filter_input(INPUT_GET, 'error_description', FILTER_SANITIZE_SPECIAL_CHARS); |
373 | 373 | $error_uri = filter_input(INPUT_GET, 'error_uri', FILTER_SANITIZE_SPECIAL_CHARS); |
374 | 374 | |
@@ -425,11 +425,11 @@ discard block |
||
425 | 425 | * http://tools.ietf.org/html/rfc6749#section-4.1.1 |
426 | 426 | */ |
427 | 427 | if ($this->supportRequestState |
428 | - && (!$state || $this->getStoredData('authorization_state') != $state) |
|
428 | + && ( ! $state || $this->getStoredData('authorization_state') != $state) |
|
429 | 429 | ) { |
430 | 430 | $this->deleteStoredData('authorization_state'); |
431 | 431 | throw new InvalidAuthorizationStateException( |
432 | - 'The authorization state [state=' . substr(htmlentities($state), 0, 100) . '] ' |
|
432 | + 'The authorization state [state='.substr(htmlentities($state), 0, 100).'] ' |
|
433 | 433 | . 'of this page is either invalid or has already been consumed.' |
434 | 434 | ); |
435 | 435 | } |
@@ -471,23 +471,23 @@ discard block |
||
471 | 471 | */ |
472 | 472 | protected function getAuthorizeUrl($parameters = []) |
473 | 473 | { |
474 | - $this->AuthorizeUrlParameters = !empty($parameters) |
|
474 | + $this->AuthorizeUrlParameters = ! empty($parameters) |
|
475 | 475 | ? $parameters |
476 | 476 | : array_replace( |
477 | - (array)$this->AuthorizeUrlParameters, |
|
478 | - (array)$this->config->get('authorize_url_parameters') |
|
477 | + (array) $this->AuthorizeUrlParameters, |
|
478 | + (array) $this->config->get('authorize_url_parameters') |
|
479 | 479 | ); |
480 | 480 | |
481 | 481 | if ($this->supportRequestState) { |
482 | - if (!isset($this->AuthorizeUrlParameters['state'])) { |
|
483 | - $this->AuthorizeUrlParameters['state'] = 'HA-' . str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'); |
|
482 | + if ( ! isset($this->AuthorizeUrlParameters['state'])) { |
|
483 | + $this->AuthorizeUrlParameters['state'] = 'HA-'.str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | $this->storeData('authorization_state', $this->AuthorizeUrlParameters['state']); |
487 | 487 | } |
488 | 488 | |
489 | 489 | $queryParams = http_build_query($this->AuthorizeUrlParameters, '', '&', $this->AuthorizeUrlParametersEncType); |
490 | - return $this->authorizeUrl . '?' . $queryParams; |
|
490 | + return $this->authorizeUrl.'?'.$queryParams; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -567,9 +567,9 @@ discard block |
||
567 | 567 | |
568 | 568 | $collection = new Data\Collection($data); |
569 | 569 | |
570 | - if (!$collection->exists('access_token')) { |
|
570 | + if ( ! $collection->exists('access_token')) { |
|
571 | 571 | throw new InvalidAccessTokenException( |
572 | - 'Provider returned no access_token: ' . htmlentities($response) |
|
572 | + 'Provider returned no access_token: '.htmlentities($response) |
|
573 | 573 | ); |
574 | 574 | } |
575 | 575 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | // calculate when the access token expire |
584 | 584 | if ($collection->exists('expires_in')) { |
585 | - $expires_at = time() + (int)$collection->get('expires_in'); |
|
585 | + $expires_at = time() + (int) $collection->get('expires_in'); |
|
586 | 586 | |
587 | 587 | $this->storeData('expires_in', $collection->get('expires_in')); |
588 | 588 | $this->storeData('expires_at', $expires_at); |
@@ -620,11 +620,11 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function refreshAccessToken($parameters = []) |
622 | 622 | { |
623 | - $this->tokenRefreshParameters = !empty($parameters) |
|
623 | + $this->tokenRefreshParameters = ! empty($parameters) |
|
624 | 624 | ? $parameters |
625 | 625 | : $this->tokenRefreshParameters; |
626 | 626 | |
627 | - if (!$this->isRefreshTokenAvailable()) { |
|
627 | + if ( ! $this->isRefreshTokenAvailable()) { |
|
628 | 628 | return null; |
629 | 629 | } |
630 | 630 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | } |
656 | 656 | |
657 | 657 | $expires_at = $this->getStoredData('expires_at'); |
658 | - if (!$expires_at) { |
|
658 | + if ( ! $expires_at) { |
|
659 | 659 | return null; |
660 | 660 | } |
661 | 661 | |
@@ -721,21 +721,21 @@ discard block |
||
721 | 721 | } |
722 | 722 | |
723 | 723 | if (strrpos($url, 'http://') !== 0 && strrpos($url, 'https://') !== 0) { |
724 | - $url = rtrim($this->apiBaseUrl, '/') . '/' . ltrim($url, '/'); |
|
724 | + $url = rtrim($this->apiBaseUrl, '/').'/'.ltrim($url, '/'); |
|
725 | 725 | } |
726 | 726 | |
727 | - $parameters = array_replace($this->apiRequestParameters, (array)$parameters); |
|
728 | - $headers = array_replace($this->apiRequestHeaders, (array)$headers); |
|
727 | + $parameters = array_replace($this->apiRequestParameters, (array) $parameters); |
|
728 | + $headers = array_replace($this->apiRequestHeaders, (array) $headers); |
|
729 | 729 | |
730 | 730 | $response = $this->httpClient->request( |
731 | 731 | $url, |
732 | - $method, // HTTP Request Method. Defaults to GET. |
|
732 | + $method, // HTTP Request Method. Defaults to GET. |
|
733 | 733 | $parameters, // Request Parameters |
734 | - $headers, // Request Headers |
|
734 | + $headers, // Request Headers |
|
735 | 735 | $multipart // Is request multipart |
736 | 736 | ); |
737 | 737 | |
738 | - $this->validateApiResponse('Signed API request to ' . $url . ' has returned an error'); |
|
738 | + $this->validateApiResponse('Signed API request to '.$url.' has returned an error'); |
|
739 | 739 | |
740 | 740 | $response = (new Data\Parser())->parse($response); |
741 | 741 |