@@ -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 | } |
@@ -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 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use DateTime; |
17 | 17 | use Psr\Http\Message\{RequestInterface, ResponseInterface, UriInterface}; |
18 | 18 | |
19 | -abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface{ |
|
19 | +abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var string |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ->withHeader('Authorization', 'OAuth '.Psr7\build_http_query($params, true, ', ', '"')); |
60 | 60 | ; |
61 | 61 | |
62 | - foreach($this->authHeaders as $header => $value){ |
|
62 | + foreach ($this->authHeaders as $header => $value) { |
|
63 | 63 | $request = $request->withAddedHeader($header, $value); |
64 | 64 | } |
65 | 65 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | protected function parseTokenResponse(ResponseInterface $response, bool $checkCallbackConfirmed = null):AccessToken{ |
77 | 77 | parse_str($response->getBody()->getContents(), $data); |
78 | 78 | |
79 | - if(!$data || !is_array($data)){ |
|
79 | + if (!$data || !is_array($data)) { |
|
80 | 80 | throw new ProviderException('unable to parse token response'); |
81 | 81 | } |
82 | - elseif(isset($data['error'])){ |
|
82 | + elseif (isset($data['error'])) { |
|
83 | 83 | throw new ProviderException('error retrieving access token: '.$data['error']); |
84 | 84 | } |
85 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
85 | + elseif (!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])) { |
|
86 | 86 | throw new ProviderException('token missing'); |
87 | 87 | } |
88 | 88 | |
89 | - if($checkCallbackConfirmed && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true')){ |
|
89 | + if ($checkCallbackConfirmed && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true')) { |
|
90 | 90 | throw new ProviderException('oauth callback unconfirmed'); |
91 | 91 | } |
92 | 92 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | protected function getSignature(string $url, array $params, string $method, string $accessTokenSecret = null):string{ |
132 | 132 | $parseURL = parse_url($url); |
133 | 133 | |
134 | - if(!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)){ |
|
134 | + if (!isset($parseURL['host']) || !isset($parseURL['scheme']) || !in_array($parseURL['scheme'], ['http', 'https'], true)) { |
|
135 | 135 | throw new ProviderException('getSignature: invalid url'); |
136 | 136 | } |
137 | 137 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | $signatureParams = array_merge($query, $params); |
141 | 141 | |
142 | - if(isset($signatureParams['oauth_signature'])){ |
|
142 | + if (isset($signatureParams['oauth_signature'])) { |
|
143 | 143 | unset($signatureParams['oauth_signature']); |
144 | 144 | } |
145 | 145 |
@@ -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 | * @param \chillerlan\OAuth\Core\AccessToken|null $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 | * @return \chillerlan\OAuth\Core\AccessToken |