@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * Implements an abstract OAuth1 provider with all methods required by the OAuth1Interface. |
| 23 | 23 | */ |
| 24 | -abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface{ |
|
| 24 | +abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface { |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * The request OAuth1 token URL |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ->withHeader('Content-Length', '0') // tumblr requires a content-length header set |
| 61 | 61 | ; |
| 62 | 62 | |
| 63 | - foreach($this->authHeaders as $header => $value){ |
|
| 63 | + foreach ($this->authHeaders as $header => $value) { |
|
| 64 | 64 | $request = $request->withAddedHeader($header, $value); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | protected function parseTokenResponse(ResponseInterface $response, bool $checkCallbackConfirmed = null):AccessToken{ |
| 82 | 82 | $data = $this->parseQuery(decompress_content($response)); |
| 83 | 83 | |
| 84 | - if(empty($data)){ |
|
| 84 | + if (empty($data)) { |
|
| 85 | 85 | throw new ProviderException('unable to parse token response'); |
| 86 | 86 | } |
| 87 | - elseif(isset($data['error'])){ |
|
| 87 | + elseif (isset($data['error'])) { |
|
| 88 | 88 | throw new ProviderException('error retrieving access token: '.$data['error']); |
| 89 | 89 | } |
| 90 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
| 90 | + elseif (!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])) { |
|
| 91 | 91 | throw new ProviderException('invalid token'); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if( |
|
| 94 | + if ( |
|
| 95 | 95 | $checkCallbackConfirmed |
| 96 | 96 | && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') |
| 97 | - ){ |
|
| 97 | + ) { |
|
| 98 | 98 | throw new ProviderException('oauth callback unconfirmed'); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | protected function getSignature(string $url, array $params, string $method, string $accessTokenSecret = null):string{ |
| 146 | 146 | $parseURL = parseUrl($url); |
| 147 | 147 | |
| 148 | - if(!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)){ |
|
| 148 | + if (!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)) { |
|
| 149 | 149 | throw new ProviderException('getSignature: invalid url'); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $token->accessTokenSecret |
| 204 | 204 | ); |
| 205 | 205 | |
| 206 | - if(isset($query['oauth_session_handle'])){ |
|
| 206 | + if (isset($query['oauth_session_handle'])) { |
|
| 207 | 207 | $parameters['oauth_session_handle'] = $query['oauth_session_handle']; // @codeCoverageIgnore |
| 208 | 208 | } |
| 209 | 209 | |
@@ -83,11 +83,9 @@ |
||
| 83 | 83 | |
| 84 | 84 | if(empty($data)){ |
| 85 | 85 | throw new ProviderException('unable to parse token response'); |
| 86 | - } |
|
| 87 | - elseif(isset($data['error'])){ |
|
| 86 | + } elseif(isset($data['error'])){ |
|
| 88 | 87 | throw new ProviderException('error retrieving access token: '.$data['error']); |
| 89 | - } |
|
| 90 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
| 88 | + } elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
| 91 | 89 | throw new ProviderException('invalid token'); |
| 92 | 90 | } |
| 93 | 91 | |