Completed
Push — master ( 9c41d8...ca3d4a )
by smiley
01:57
created
src/Providers/OAuth2TokenRefreshTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
55 55
 			)
56 56
 		);
57 57
 
58
-		if(!$newToken->refreshToken){
58
+		if (!$newToken->refreshToken) {
59 59
 			$newToken->refreshToken = $refreshToken;
60 60
 		}
61 61
 
Please login to merge, or discard this patch.
src/Providers/AccessTokenForRefresh.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\OAuth\Providers;
14 14
 
15
-interface AccessTokenForRefresh{
15
+interface AccessTokenForRefresh {
16 16
 
17 17
 }
Please login to merge, or discard this patch.
src/Providers/OAuth2ClientCredentialsTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Providers/CSRFToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\OAuth\Providers;
14 14
 
15
-interface CSRFToken{
15
+interface CSRFToken {
16 16
 
17 17
 }
Please login to merge, or discard this patch.
src/Providers/CSRFTokenTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Providers/ProviderException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,4 +14,4 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\OAuth\OAuthException;
16 16
 
17
-class ProviderException extends OAuthException{}
17
+class ProviderException extends OAuthException {}
Please login to merge, or discard this patch.
src/Providers/TokenRefresh.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Providers/OAuthInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Providers/ClientCredentials.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.