@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
| 13 | 13 | |
| 14 | -class SpotifyEndpoints extends EndpointMap{ |
|
| 14 | +class SpotifyEndpoints extends EndpointMap { |
|
| 15 | 15 | |
| 16 | 16 | protected string $API_BASE = '/v1'; |
| 17 | 17 | |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | protected array $authHeaders = ['Accept' => 'application/vnd.vimeo.*+json;version='.self::API_VERSION]; |
| 125 | 125 | protected array $apiHeaders = ['Accept' => 'application/vnd.vimeo.*+json;version='.self::API_VERSION]; |
| 126 | 126 | |
| 127 | - protected array $defaultScopes = [ |
|
| 127 | + protected array $defaultScopes = [ |
|
| 128 | 128 | self::SCOPE_PRIVATE, |
| 129 | 129 | self::SCOPE_INTERACT, |
| 130 | 130 | ]; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
| 13 | 13 | |
| 14 | -class OpenCachingEndpoints extends EndpointMap{ |
|
| 14 | +class OpenCachingEndpoints extends EndpointMap { |
|
| 15 | 15 | |
| 16 | 16 | protected string $API_BASE = '/services'; |
| 17 | 17 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
| 13 | 13 | |
| 14 | -class LastFMEndpoints extends EndpointMap{ |
|
| 14 | +class LastFMEndpoints extends EndpointMap { |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Tag an album using a list of user supplied tags. |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
| 13 | 13 | |
| 14 | -class SoundCloudEndpoints extends EndpointMap{ |
|
| 14 | +class SoundCloudEndpoints extends EndpointMap { |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Returns the authenticated user’s information. |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | * @method \Psr\Http\Message\ResponseInterface usersUserIdTracks(string $user_id, array $params = ['limit', 'linked_partitioning']) |
| 75 | 75 | * @method \Psr\Http\Message\ResponseInterface usersUserIdWebProfiles(string $user_id, array $params = ['limit']) |
| 76 | 76 | */ |
| 77 | -class SoundCloud extends OAuth2Provider{ |
|
| 77 | +class SoundCloud extends OAuth2Provider { |
|
| 78 | 78 | |
| 79 | 79 | public const SCOPE_NONEXPIRING = 'non-expiring'; |
| 80 | 80 | # public const SCOPE_EMAIL = 'email'; // ??? |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function refreshAccessToken(AccessToken $token = null):AccessToken{ |
| 94 | 94 | |
| 95 | - if($token === null){ |
|
| 95 | + if ($token === null) { |
|
| 96 | 96 | $token = $this->storage->getAccessToken($this->serviceName); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $refreshToken = $token->refreshToken; |
| 100 | 100 | |
| 101 | - if(empty($refreshToken)){ |
|
| 101 | + if (empty($refreshToken)) { |
|
| 102 | 102 | throw new ProviderException( |
| 103 | 103 | sprintf('no refresh token available, token expired [%s]', date('Y-m-d h:i:s A', $token->expires)) |
| 104 | 104 | ); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $newToken = $this->parseTokenResponse($this->http->sendRequest($request)); |
| 122 | 122 | |
| 123 | - if(empty($newToken->refreshToken)){ |
|
| 123 | + if (empty($newToken->refreshToken)) { |
|
| 124 | 124 | $newToken->refreshToken = $refreshToken; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -143,15 +143,15 @@ discard block |
||
| 143 | 143 | $method = strtoupper($method ?? ''); |
| 144 | 144 | $token = $this->storage->getAccessToken($this->serviceName); |
| 145 | 145 | |
| 146 | - if($token->isExpired()){ |
|
| 146 | + if ($token->isExpired()) { |
|
| 147 | 147 | $this->refreshAccessToken($token); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if(!isset($params['fmt'])){ |
|
| 150 | + if (!isset($params['fmt'])) { |
|
| 151 | 151 | $params['fmt'] = 'json'; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if(in_array($method, ['POST', 'PUT', 'DELETE']) && !isset($params['client'])){ |
|
| 154 | + if (in_array($method, ['POST', 'PUT', 'DELETE']) && !isset($params['client'])) { |
|
| 155 | 155 | $params['client'] = $this->options->user_agent; // @codeCoverageIgnore |
| 156 | 156 | } |
| 157 | 157 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * @method \Psr\Http\Message\ResponseInterface me() |
| 28 | 28 | */ |
| 29 | -class Deezer extends OAuth2Provider implements CSRFToken{ |
|
| 29 | +class Deezer extends OAuth2Provider implements CSRFToken { |
|
| 30 | 30 | |
| 31 | 31 | public const SCOPE_BASIC = 'basic_access'; |
| 32 | 32 | public const SCOPE_EMAIL = 'email'; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function getAuthURL(array $params = null, array $scopes = null):UriInterface{ |
| 60 | 60 | $params = $params ?? []; |
| 61 | 61 | |
| 62 | - if(isset($params['client_secret'])){ |
|
| 62 | + if (isset($params['client_secret'])) { |
|
| 63 | 63 | unset($params['client_secret']); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
| 108 | 108 | $data = $this->parseQuery(decompress_content($response)); |
| 109 | 109 | |
| 110 | - if(isset($data['error_reason'])){ |
|
| 110 | + if (isset($data['error_reason'])) { |
|
| 111 | 111 | throw new ProviderException('error retrieving access token: "'.$data['error_reason'].'"'); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if(!isset($data['access_token'])){ |
|
| 114 | + if (!isset($data['access_token'])) { |
|
| 115 | 115 | throw new ProviderException('token missing'); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @method \Psr\Http\Message\ResponseInterface wvwUpgrades(array $params = ['lang']) |
| 238 | 238 | * @method \Psr\Http\Message\ResponseInterface wvwUpgradesId(string $id, array $params = ['lang']) |
| 239 | 239 | */ |
| 240 | -class GuildWars2 extends OAuth2Provider{ |
|
| 240 | +class GuildWars2 extends OAuth2Provider { |
|
| 241 | 241 | |
| 242 | 242 | public const SCOPE_ACCOUNT = 'account'; |
| 243 | 243 | public const SCOPE_INVENTORIES = 'inventories'; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | public function storeGW2Token(string $access_token):AccessToken{ |
| 269 | 269 | |
| 270 | - if(!preg_match('/^[a-f\d\-]{72}$/i', $access_token)){ |
|
| 270 | + if (!preg_match('/^[a-f\d\-]{72}$/i', $access_token)) { |
|
| 271 | 271 | throw new ProviderException('invalid token'); |
| 272 | 272 | } |
| 273 | 273 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | $tokeninfo = get_json($this->http->sendRequest($request)); |
| 279 | 279 | |
| 280 | - if(isset($tokeninfo->id) && strpos($access_token, $tokeninfo->id) === 0){ |
|
| 280 | + if (isset($tokeninfo->id) && strpos($access_token, $tokeninfo->id) === 0) { |
|
| 281 | 281 | |
| 282 | 282 | $token = new AccessToken([ |
| 283 | 283 | 'provider' => $this->serviceName, |