@@ -12,4 +12,4 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth; |
14 | 14 | |
15 | -class OAuthException extends \Exception{} |
|
15 | +class OAuthException extends \Exception {} |
@@ -14,4 +14,4 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\OAuth\OAuthException; |
16 | 16 | |
17 | -class ProviderException extends OAuthException{} |
|
17 | +class ProviderException extends OAuthException {} |
@@ -14,4 +14,4 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\OAuth\OAuthException; |
16 | 16 | |
17 | -class OAuthStorageException extends OAuthException{} |
|
17 | +class OAuthStorageException extends OAuthException {} |
@@ -78,11 +78,9 @@ |
||
78 | 78 | |
79 | 79 | if(!$data || !is_array($data)){ |
80 | 80 | throw new ProviderException('unable to parse token response'); |
81 | - } |
|
82 | - elseif(isset($data['error'])){ |
|
81 | + } elseif(isset($data['error'])){ |
|
83 | 82 | throw new ProviderException('error retrieving access token: '.$data['error']); |
84 | - } |
|
85 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
83 | + } elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
86 | 84 | throw new ProviderException('invalid token'); |
87 | 85 | } |
88 | 86 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | implode, in_array, is_array, parse_str, parse_url, random_bytes, strtoupper; |
20 | 20 | use function chillerlan\HTTP\Psr7\{build_http_query, decompress_content, merge_query, r_rawurlencode}; |
21 | 21 | |
22 | -abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface{ |
|
22 | +abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * the request token URL |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ->withHeader('Accept-Encoding', 'identity') |
62 | 62 | ; |
63 | 63 | |
64 | - foreach($this->authHeaders as $header => $value){ |
|
64 | + foreach ($this->authHeaders as $header => $value) { |
|
65 | 65 | $request = $request->withAddedHeader($header, $value); |
66 | 66 | } |
67 | 67 | |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | protected function parseTokenResponse(ResponseInterface $response, bool $checkCallbackConfirmed = null):AccessToken{ |
79 | 79 | parse_str(decompress_content($response), $data); |
80 | 80 | |
81 | - if(!$data || !is_array($data)){ |
|
81 | + if (!$data || !is_array($data)) { |
|
82 | 82 | throw new ProviderException('unable to parse token response'); |
83 | 83 | } |
84 | - elseif(isset($data['error'])){ |
|
84 | + elseif (isset($data['error'])) { |
|
85 | 85 | throw new ProviderException('error retrieving access token: '.$data['error']); |
86 | 86 | } |
87 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
87 | + elseif (!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])) { |
|
88 | 88 | throw new ProviderException('invalid token'); |
89 | 89 | } |
90 | 90 | |
91 | - if( |
|
91 | + if ( |
|
92 | 92 | $checkCallbackConfirmed |
93 | 93 | && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') |
94 | - ){ |
|
94 | + ) { |
|
95 | 95 | throw new ProviderException('oauth callback unconfirmed'); |
96 | 96 | } |
97 | 97 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | protected function getSignature(string $url, array $params, string $method, string $accessTokenSecret = null):string{ |
138 | 138 | $parseURL = parse_url($url); |
139 | 139 | |
140 | - if(!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)){ |
|
140 | + if (!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)) { |
|
141 | 141 | throw new ProviderException('getSignature: invalid url'); |
142 | 142 | } |
143 | 143 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $signatureParams = array_merge($query, $params); |
147 | 147 | |
148 | - if(isset($signatureParams['oauth_signature'])){ |
|
148 | + if (isset($signatureParams['oauth_signature'])) { |
|
149 | 149 | unset($signatureParams['oauth_signature']); |
150 | 150 | } |
151 | 151 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $token->accessTokenSecret |
198 | 198 | ); |
199 | 199 | |
200 | - if(isset($query['oauth_session_handle'])){ |
|
200 | + if (isset($query['oauth_session_handle'])) { |
|
201 | 201 | $parameters['oauth_session_handle'] = $query['oauth_session_handle']; // @codeCoverageIgnore |
202 | 202 | } |
203 | 203 |
@@ -18,6 +18,6 @@ |
||
18 | 18 | * checkState(string $state = null):void |
19 | 19 | * setState(array $params):array |
20 | 20 | */ |
21 | -interface CSRFToken{ |
|
21 | +interface CSRFToken { |
|
22 | 22 | |
23 | 23 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth; |
14 | 14 | |
15 | -trait OAuthOptionsTrait{ |
|
15 | +trait OAuthOptionsTrait { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * The application key (or id) given by your provider |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Core; |
14 | 14 | |
15 | -interface TokenRefresh{ |
|
15 | +interface TokenRefresh { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Tries to refresh an existing access token with an associated refresh token |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Core; |
14 | 14 | |
15 | -interface OAuth1Interface extends OAuthInterface{ |
|
15 | +interface OAuth1Interface extends OAuthInterface { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Obtains an OAuth1 request token and returns an AccessToken |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Core; |
14 | 14 | |
15 | -interface ClientCredentials{ |
|
15 | +interface ClientCredentials { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Obtains an OAuth2 client credentials token and returns an AccessToken |