@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @property \chillerlan\OAuth\Storage\TokenStorageInterface $storage |
22 | 22 | * @property \chillerlan\OAuth\OAuthOptions $options |
23 | 23 | */ |
24 | -trait OAuth2TokenRefreshTrait{ |
|
24 | +trait OAuth2TokenRefreshTrait { |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @param \chillerlan\OAuth\Token $token |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function refreshAccessToken(Token $token = null):Token{ |
33 | 33 | |
34 | - if($token === null){ |
|
34 | + if ($token === null) { |
|
35 | 35 | $token = $this->storage->retrieveAccessToken($this->serviceName); |
36 | 36 | } |
37 | 37 | |
38 | 38 | $refreshToken = $token->refreshToken; |
39 | 39 | |
40 | - if(empty($refreshToken)){ |
|
40 | + if (empty($refreshToken)) { |
|
41 | 41 | |
42 | - if(!$this instanceof AccessTokenForRefresh){ |
|
42 | + if (!$this instanceof AccessTokenForRefresh) { |
|
43 | 43 | throw new ProviderException(sprintf('no refresh token available, token expired [%s]', date('Y-m-d h:i:s A', $token->expires))); |
44 | 44 | } |
45 | 45 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ) |
56 | 56 | ); |
57 | 57 | |
58 | - if(!$newToken->refreshToken){ |
|
58 | + if (!$newToken->refreshToken) { |
|
59 | 59 | $newToken->refreshToken = $refreshToken; |
60 | 60 | } |
61 | 61 |
@@ -12,6 +12,6 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Providers; |
14 | 14 | |
15 | -interface AccessTokenForRefresh{ |
|
15 | +interface AccessTokenForRefresh { |
|
16 | 16 | |
17 | 17 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @property string $accessTokenURL |
22 | 22 | * @property \chillerlan\OAuth\Storage\TokenStorageInterface $storage |
23 | 23 | */ |
24 | -trait OAuth2ClientCredentialsTrait{ |
|
24 | +trait OAuth2ClientCredentialsTrait { |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @param array $scopes |
@@ -12,6 +12,6 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Providers; |
14 | 14 | |
15 | -interface CSRFToken{ |
|
15 | +interface CSRFToken { |
|
16 | 16 | |
17 | 17 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @property string $serviceName |
19 | 19 | * @property \chillerlan\OAuth\Storage\TokenStorageInterface $storage |
20 | 20 | */ |
21 | -trait CSRFTokenTrait{ |
|
21 | +trait CSRFTokenTrait { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @param string|null $state |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected function checkState(string $state = null):OAuth2Interface{ |
30 | 30 | |
31 | - if(empty($state) || !$this->storage->hasAuthorizationState($this->serviceName)){ |
|
31 | + if (empty($state) || !$this->storage->hasAuthorizationState($this->serviceName)) { |
|
32 | 32 | throw new ProviderException('invalid state for '.$this->serviceName); |
33 | 33 | } |
34 | 34 | |
35 | 35 | $knownState = $this->storage->retrieveAuthorizationState($this->serviceName); |
36 | 36 | |
37 | - if(!hash_equals($knownState, $state)){ |
|
37 | + if (!hash_equals($knownState, $state)) { |
|
38 | 38 | throw new ProviderException('invalid authorization state: '.$this->serviceName.' '.$state); |
39 | 39 | } |
40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected function setState(array $params):array { |
50 | 50 | |
51 | - if(!isset($params['state'])){ |
|
51 | + if (!isset($params['state'])) { |
|
52 | 52 | $params['state'] = sha1(random_bytes(256)); |
53 | 53 | } |
54 | 54 |
@@ -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,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\OAuth\Token; |
16 | 16 | |
17 | -interface TokenRefresh{ |
|
17 | +interface TokenRefresh { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @param \chillerlan\OAuth\Token|null $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 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\OAuth\Token; |
16 | 16 | |
17 | -interface ClientCredentials{ |
|
17 | +interface ClientCredentials { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @param array $scopes |