@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth; |
14 | 14 | |
15 | -trait OAuthOptionsTrait{ |
|
15 | +trait OAuthOptionsTrait { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @var string |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * @var string |
78 | 78 | */ |
79 | - protected $dbLabelFormat = '%1$s@%2$s'; // user@service |
|
79 | + protected $dbLabelFormat = '%1$s@%2$s'; // user@service |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @var int|string |
@@ -12,4 +12,4 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth; |
14 | 14 | |
15 | -class OAuthException extends \Exception{} |
|
15 | +class OAuthException extends \Exception {} |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * |
19 | 19 | */ |
20 | -class OAuth1Testprovider extends OAuth1Provider{ |
|
20 | +class OAuth1Testprovider extends OAuth1Provider { |
|
21 | 21 | |
22 | 22 | protected $apiURL = 'https://api.example.com'; |
23 | 23 | protected $requestTokenURL = 'https://example.com/oauth/request_token'; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * @property string $serviceName |
20 | 20 | * @property string $userRevokeURL |
21 | 21 | */ |
22 | -interface OAuthInterface{ |
|
22 | +interface OAuthInterface { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @param array $params |
@@ -12,6 +12,6 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Core; |
14 | 14 | |
15 | -interface TokenExpires{ |
|
15 | +interface TokenExpires { |
|
16 | 16 | |
17 | 17 | } |
@@ -14,4 +14,4 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\OAuth\OAuthException; |
16 | 16 | |
17 | -class ProviderException extends OAuthException{} |
|
17 | +class ProviderException extends OAuthException {} |
@@ -12,6 +12,6 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Core; |
14 | 14 | |
15 | -interface CSRFToken{ |
|
15 | +interface CSRFToken { |
|
16 | 16 | |
17 | 17 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use chillerlan\HTTP\HTTPResponseInterface; |
16 | 16 | use DateTime; |
17 | 17 | |
18 | -abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface{ |
|
18 | +abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var string |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return \chillerlan\OAuth\Core\AccessToken |
47 | 47 | */ |
48 | 48 | public function getRequestToken():AccessToken { |
49 | - $params = $this->getRequestTokenHeaderParams(); |
|
49 | + $params = $this->getRequestTokenHeaderParams(); |
|
50 | 50 | |
51 | 51 | return $this->parseTokenResponse( |
52 | 52 | $this->httpPOST( |
@@ -71,19 +71,19 @@ discard block |
||
71 | 71 | protected function parseTokenResponse(HTTPResponseInterface $response, bool $checkCallbackConfirmed = null):AccessToken { |
72 | 72 | parse_str($response->body, $data); |
73 | 73 | |
74 | - if(!$data || !is_array($data)){ |
|
74 | + if (!$data || !is_array($data)) { |
|
75 | 75 | throw new ProviderException('unable to parse token response'); |
76 | 76 | } |
77 | - elseif(isset($data['error'])){ |
|
77 | + elseif (isset($data['error'])) { |
|
78 | 78 | throw new ProviderException('error retrieving access token: '.$data['error']); |
79 | 79 | } |
80 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
80 | + elseif (!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])) { |
|
81 | 81 | throw new ProviderException('token missing'); |
82 | 82 | } |
83 | 83 | |
84 | - if(($checkCallbackConfirmed ?? false) |
|
84 | + if (($checkCallbackConfirmed ?? false) |
|
85 | 85 | && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') |
86 | - ){ |
|
86 | + ) { |
|
87 | 87 | throw new ProviderException('oauth callback unconfirmed'); |
88 | 88 | } |
89 | 89 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | public function getSignature(string $url, array $params, string $method = null):string { |
147 | 147 | $parseURL = parse_url($url); |
148 | 148 | |
149 | - if(!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)){ |
|
149 | + if (!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)) { |
|
150 | 150 | throw new ProviderException('getSignature: invalid url'); |
151 | 151 | } |
152 | 152 | |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return string |
172 | 172 | */ |
173 | - protected function getSignatureData(string $signatureURL, array $signatureParams, string $method){ |
|
173 | + protected function getSignatureData(string $signatureURL, array $signatureParams, string $method) { |
|
174 | 174 | |
175 | - if(isset($signatureParams['oauth_signature'])){ |
|
175 | + if (isset($signatureParams['oauth_signature'])) { |
|
176 | 176 | unset($signatureParams['oauth_signature']); |
177 | 177 | } |
178 | 178 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function getAccessToken(string $token, string $verifier, string $tokenSecret = null):AccessToken { |
196 | 196 | $this->tokenSecret = $tokenSecret; |
197 | 197 | |
198 | - if(empty($this->tokenSecret)){ |
|
198 | + if (empty($this->tokenSecret)) { |
|
199 | 199 | $this->tokenSecret = $this->storage->getAccessToken($this->serviceName)->requestTokenSecret; |
200 | 200 | } |
201 | 201 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | $parameters['oauth_signature'] = $this->getSignature($url, array_merge($params ?? [], $parameters), $method); |
233 | 233 | |
234 | - if(isset($params['oauth_session_handle'])){ |
|
234 | + if (isset($params['oauth_session_handle'])) { |
|
235 | 235 | $parameters['oauth_session_handle'] = $params['oauth_session_handle']; |
236 | 236 | unset($params['oauth_session_handle']); |
237 | 237 | } |
@@ -74,11 +74,9 @@ |
||
74 | 74 | |
75 | 75 | if(!$data || !is_array($data)){ |
76 | 76 | throw new ProviderException('unable to parse token response'); |
77 | - } |
|
78 | - elseif(isset($data['error'])){ |
|
77 | + } elseif(isset($data['error'])){ |
|
79 | 78 | throw new ProviderException('error retrieving access token: '.$data['error']); |
80 | - } |
|
81 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
79 | + } elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
82 | 80 | throw new ProviderException('token missing'); |
83 | 81 | } |
84 | 82 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * @property string $accessTokenURL |
20 | 20 | * @property \chillerlan\OAuth\Storage\OAuthStorageInterface $storage |
21 | 21 | */ |
22 | -trait OAuth2ClientCredentialsTrait{ |
|
22 | +trait OAuth2ClientCredentialsTrait { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @param array $scopes |