@@ -47,21 +47,21 @@ discard block |
||
| 47 | 47 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
| 48 | 48 | $data = json_decode(decompress_content($response), true); |
| 49 | 49 | |
| 50 | - if(!is_array($data)){ |
|
| 50 | + if (!is_array($data)) { |
|
| 51 | 51 | throw new ProviderException('unable to parse token response'); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - foreach(['error_description', 'error'] as $field){ |
|
| 55 | - if(isset($data[$field])){ |
|
| 54 | + foreach (['error_description', 'error'] as $field) { |
|
| 55 | + if (isset($data[$field])) { |
|
| 56 | 56 | throw new ProviderException('error retrieving access token: "'.$data[$field].'"'); |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // @codeCoverageIgnoreStart |
| 61 | - if(isset($data['name'], $data['message'])){ |
|
| 61 | + if (isset($data['name'], $data['message'])) { |
|
| 62 | 62 | $msg = sprintf('error retrieving access token: "%s" [%s]', $data['message'], $data['name']); |
| 63 | 63 | |
| 64 | - if(isset($data['links']) && is_array($data['links'])){ |
|
| 64 | + if (isset($data['links']) && is_array($data['links'])) { |
|
| 65 | 65 | $msg .= "\n".implode("\n", array_column($data['links'], 'href')); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | // @codeCoverageIgnoreEnd |
| 71 | 71 | |
| 72 | - if(!isset($data['access_token'])){ |
|
| 72 | + if (!isset($data['access_token'])) { |
|
| 73 | 73 | throw new ProviderException('token missing'); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | protected function getRequestTarget(string $uri):string{ |
| 57 | 57 | $parsedURL = parse_url($uri); |
| 58 | 58 | |
| 59 | - if(!isset($parsedURL['path'])){ |
|
| 59 | + if (!isset($parsedURL['path'])) { |
|
| 60 | 60 | throw new ProviderException('invalid path'); // @codeCoverageIgnore |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // for some reason we were given a host name |
| 64 | - if(isset($parsedURL['host'])){ |
|
| 64 | + if (isset($parsedURL['host'])) { |
|
| 65 | 65 | |
| 66 | 66 | // back out if it doesn't match |
| 67 | - if(strpos($parsedURL['host'], '.api.npr.org') === false){ |
|
| 67 | + if (strpos($parsedURL['host'], '.api.npr.org') === false) { |
|
| 68 | 68 | throw new ProviderException('given host does not match provider host'); // @codeCoverageIgnore |
| 69 | 69 | } |
| 70 | 70 | |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | public function sendRequest(RequestInterface $request):ResponseInterface{ |
| 83 | 83 | |
| 84 | 84 | // get authorization only if we request the provider API |
| 85 | - if(strpos((string)$request->getUri(), '.api.npr.org') !== false){ |
|
| 85 | + if (strpos((string)$request->getUri(), '.api.npr.org') !== false) { |
|
| 86 | 86 | $token = $this->storage->getAccessToken($this->serviceName); |
| 87 | 87 | |
| 88 | 88 | // attempt to refresh an expired token |
| 89 | - if( |
|
| 89 | + if ( |
|
| 90 | 90 | $this instanceof TokenRefresh |
| 91 | 91 | && $this->options->tokenAutoRefresh |
| 92 | 92 | && ($token->isExpired() || $token->expires === $token::EOL_UNKNOWN) |
| 93 | - ){ |
|
| 93 | + ) { |
|
| 94 | 94 | $token = $this->refreshAccessToken($token); // @codeCoverageIgnore |
| 95 | 95 | } |
| 96 | 96 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @method \Psr\Http\Message\ResponseInterface steamWebAPIUtilGetSupportedAPIList() |
| 50 | 50 | * @method \Psr\Http\Message\ResponseInterface storeServiceGetAppList(array $params = ['if_modified_since', 'have_description_language', 'include_games', 'include_dlc', 'include_software', 'include_videos', 'include_hardware', 'last_appid', 'max_results']) |
| 51 | 51 | */ |
| 52 | -class SteamOpenID extends OAuthProvider{ |
|
| 52 | +class SteamOpenID extends OAuthProvider { |
|
| 53 | 53 | |
| 54 | 54 | protected string $authURL = 'https://steamcommunity.com/openid/login'; |
| 55 | 55 | protected string $accessTokenURL = 'https://steamcommunity.com/openid/login'; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | 'openid.sig' => $received['openid_sig'], |
| 92 | 92 | ]; |
| 93 | 93 | |
| 94 | - foreach(explode(',', $received['openid_signed']) as $item){ |
|
| 94 | + foreach (explode(',', $received['openid_signed']) as $item) { |
|
| 95 | 95 | $body['openid.'.$item] = $received['openid_'.$item]; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
| 127 | 127 | $data = explode("\x0a", (string)$response->getBody()); |
| 128 | 128 | |
| 129 | - if(!isset($data[1]) || strpos($data[1], 'is_valid') !== 0){ |
|
| 129 | + if (!isset($data[1]) || strpos($data[1], 'is_valid') !== 0) { |
|
| 130 | 130 | throw new ProviderException('unable to parse token response'); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if($data[1] !== 'is_valid:true'){ |
|
| 133 | + if ($data[1] !== 'is_valid:true') { |
|
| 134 | 134 | throw new ProviderException('invalid id'); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | $params = ['key' => $this->options->secret]; |
| 153 | 153 | |
| 154 | 154 | // the steamid parameter does not necessarily specify the current user, so add it only when it's not already set |
| 155 | - if(strpos(parse_url($uri, PHP_URL_QUERY), 'steamid=') === false){ // php8: str_contains |
|
| 156 | - $params['steamid']= $token->accessToken; |
|
| 155 | + if (strpos(parse_url($uri, PHP_URL_QUERY), 'steamid=') === false) { // php8: str_contains |
|
| 156 | + $params['steamid'] = $token->accessToken; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return $request->withUri($this->uriFactory->createUri(merge_query($uri, $params))); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
| 14 | 14 | |
| 15 | -class SteamEndpoints extends EndpointMap{ |
|
| 15 | +class SteamEndpoints extends EndpointMap { |
|
| 16 | 16 | |
| 17 | 17 | /* |
| 18 | 18 | * ISteamApps |