@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @see https://www.flickr.com/services/api/auth.oauth.html |
| 24 | 24 | * @see https://www.flickr.com/services/api/ |
| 25 | 25 | */ |
| 26 | -class Flickr extends OAuth1Provider{ |
|
| 26 | +class Flickr extends OAuth1Provider { |
|
| 27 | 27 | |
| 28 | 28 | public const PERM_READ = 'read'; |
| 29 | 29 | public const PERM_WRITE = 'write'; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | string $path, |
| 45 | 45 | array $params = null, |
| 46 | 46 | string $method = null, |
| 47 | - StreamInterface|array|string $body = null, |
|
| 47 | + StreamInterface | array | string $body = null, |
|
| 48 | 48 | array $headers = null |
| 49 | 49 | ):ResponseInterface{ |
| 50 | 50 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | $status = $response->getStatusCode(); |
| 72 | 72 | $json = MessageUtil::decodeJSON($response); |
| 73 | 73 | |
| 74 | - if($status === 200 && isset($json->user)){ |
|
| 74 | + if ($status === 200 && isset($json->user)) { |
|
| 75 | 75 | return $response; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if(isset($json->message)){ |
|
| 78 | + if (isset($json->message)) { |
|
| 79 | 79 | throw new ProviderException($json->message); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * @see https://developer.wordpress.com/docs/oauth2/ |
| 20 | 20 | */ |
| 21 | -class WordPress extends OAuth2Provider implements CSRFToken{ |
|
| 21 | +class WordPress extends OAuth2Provider implements CSRFToken { |
|
| 22 | 22 | |
| 23 | 23 | public const SCOPE_AUTH = 'auth'; |
| 24 | 24 | public const SCOPE_GLOBAL = 'global'; |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | $response = $this->request('/v1/me'); |
| 42 | 42 | $status = $response->getStatusCode(); |
| 43 | 43 | |
| 44 | - if($status === 200){ |
|
| 44 | + if ($status === 200) { |
|
| 45 | 45 | return $response; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $json = MessageUtil::decodeJSON($response); |
| 49 | 49 | |
| 50 | - if(isset($json->error, $json->message)){ |
|
| 50 | + if (isset($json->error, $json->message)) { |
|
| 51 | 51 | throw new ProviderException($json->message); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -48,13 +48,13 @@ |
||
| 48 | 48 | $response = $this->request('/me'); |
| 49 | 49 | $status = $response->getStatusCode(); |
| 50 | 50 | |
| 51 | - if($status === 200){ |
|
| 51 | + if ($status === 200) { |
|
| 52 | 52 | return $response; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $json = MessageUtil::decodeJSON($response); |
| 56 | 56 | |
| 57 | - if(isset($json->status)){ |
|
| 57 | + if (isset($json->status)) { |
|
| 58 | 58 | throw new ProviderException($json->status); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -70,13 +70,13 @@ |
||
| 70 | 70 | $response = $this->request('/user'); |
| 71 | 71 | $status = $response->getStatusCode(); |
| 72 | 72 | |
| 73 | - if($status === 200){ |
|
| 73 | + if ($status === 200) { |
|
| 74 | 74 | return $response; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $json = MessageUtil::decodeJSON($response); |
| 78 | 78 | |
| 79 | - if(isset($json->message)){ |
|
| 79 | + if (isset($json->message)) { |
|
| 80 | 80 | throw new ProviderException($json->message); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * @see https://www.tumblr.com/docs/en/api/v2 |
| 21 | 21 | */ |
| 22 | -class Tumblr extends OAuth1Provider{ |
|
| 22 | +class Tumblr extends OAuth1Provider { |
|
| 23 | 23 | |
| 24 | 24 | protected string $requestTokenURL = 'https://www.tumblr.com/oauth/request_token'; |
| 25 | 25 | protected string $authURL = 'https://www.tumblr.com/oauth/authorize'; |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | $response = $this->request('/user/info'); |
| 38 | 38 | $status = $response->getStatusCode(); |
| 39 | 39 | |
| 40 | - if($status === 200){ |
|
| 40 | + if ($status === 200) { |
|
| 41 | 41 | return $response; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $json = MessageUtil::decodeJSON($response); |
| 45 | 45 | |
| 46 | - if(isset($json->meta, $json->meta->msg)){ |
|
| 46 | + if (isset($json->meta, $json->meta->msg)) { |
|
| 47 | 47 | throw new ProviderException($json->meta->msg); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @see https://api.slack.com/docs/sign-in-with-slack |
| 21 | 21 | * @see https://api.slack.com/docs/token-types |
| 22 | 22 | */ |
| 23 | -class Slack extends OAuth2Provider implements CSRFToken{ |
|
| 23 | +class Slack extends OAuth2Provider implements CSRFToken { |
|
| 24 | 24 | |
| 25 | 25 | // bot token |
| 26 | 26 | public const SCOPE_BOT = 'bot'; |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | $status = $response->getStatusCode(); |
| 101 | 101 | $json = MessageUtil::decodeJSON($response); |
| 102 | 102 | |
| 103 | - if($status === 200 && isset($json->ok) && $json->ok === true){ |
|
| 103 | + if ($status === 200 && isset($json->ok) && $json->ok === true) { |
|
| 104 | 104 | return $response; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if(isset($json->error)){ |
|
| 107 | + if (isset($json->error)) { |
|
| 108 | 108 | throw new ProviderException($json->error); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * @see https://docs.microsoft.com/graph/permissions-reference |
| 20 | 20 | */ |
| 21 | -class MicrosoftGraph extends AzureActiveDirectory{ |
|
| 21 | +class MicrosoftGraph extends AzureActiveDirectory { |
|
| 22 | 22 | |
| 23 | 23 | public const SCOPE_USER_READ = 'User.Read'; |
| 24 | 24 | public const SCOPE_USER_READBASIC_ALL = 'User.ReadBasic.All'; |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | $response = $this->request('/v1.0/me'); |
| 43 | 43 | $status = $response->getStatusCode(); |
| 44 | 44 | |
| 45 | - if($status === 200){ |
|
| 45 | + if ($status === 200) { |
|
| 46 | 46 | return $response; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $json = MessageUtil::decodeJSON($response); |
| 50 | 50 | |
| 51 | - if(isset($json->error, $json->error->message)){ |
|
| 51 | + if (isset($json->error, $json->error->message)) { |
|
| 52 | 52 | throw new ProviderException($json->error->message); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @see https://partner.steamgames.com/doc/webapi_overview |
| 22 | 22 | * @see https://steamwebapi.azurewebsites.net/ |
| 23 | 23 | */ |
| 24 | -class SteamOpenID extends OAuthProvider{ |
|
| 24 | +class SteamOpenID extends OAuthProvider { |
|
| 25 | 25 | |
| 26 | 26 | protected string $authURL = 'https://steamcommunity.com/openid/login'; |
| 27 | 27 | protected string $accessTokenURL = 'https://steamcommunity.com/openid/login'; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'openid.sig' => $received['openid_sig'], |
| 59 | 59 | ]; |
| 60 | 60 | |
| 61 | - foreach(explode(',', $received['openid_signed']) as $item){ |
|
| 61 | + foreach (explode(',', $received['openid_signed']) as $item) { |
|
| 62 | 62 | $body['openid.'.$item] = $received['openid_'.$item]; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
| 91 | 91 | $data = explode("\x0a", (string)$response->getBody()); |
| 92 | 92 | |
| 93 | - if(!isset($data[1]) || !str_starts_with($data[1], 'is_valid')){ |
|
| 93 | + if (!isset($data[1]) || !str_starts_with($data[1], 'is_valid')) { |
|
| 94 | 94 | throw new ProviderException('unable to parse token response'); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if($data[1] !== 'is_valid:true'){ |
|
| 97 | + if ($data[1] !== 'is_valid:true') { |
|
| 98 | 98 | throw new ProviderException('invalid id'); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | $params = ['key' => $this->options->secret]; |
| 115 | 115 | |
| 116 | 116 | // the steamid parameter does not necessarily specify the current user, so add it only when it's not already set |
| 117 | - if(!str_contains($uri, 'steamid=')){ |
|
| 118 | - $params['steamid']= $token->accessToken; |
|
| 117 | + if (!str_contains($uri, 'steamid=')) { |
|
| 118 | + $params['steamid'] = $token->accessToken; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return $request->withUri($this->uriFactory->createUri(QueryUtil::merge($uri, $params))); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | protected array $authHeaders = ['Accept' => 'application/vnd.vimeo.*+json;version='.self::API_VERSION]; |
| 48 | 48 | protected array $apiHeaders = ['Accept' => 'application/vnd.vimeo.*+json;version='.self::API_VERSION]; |
| 49 | 49 | |
| 50 | - protected array $defaultScopes = [ |
|
| 50 | + protected array $defaultScopes = [ |
|
| 51 | 51 | self::SCOPE_PUBLIC, |
| 52 | 52 | self::SCOPE_PRIVATE, |
| 53 | 53 | self::SCOPE_INTERACT, |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | $response = $this->request('/me'); |
| 61 | 61 | $status = $response->getStatusCode(); |
| 62 | 62 | |
| 63 | - if($status === 200){ |
|
| 63 | + if ($status === 200) { |
|
| 64 | 64 | return $response; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $json = MessageUtil::decodeJSON($response); |
| 68 | 68 | |
| 69 | - if(isset($json->error, $json->developer_message)){ |
|
| 69 | + if (isset($json->error, $json->developer_message)) { |
|
| 70 | 70 | throw new ProviderException($json->developer_message); |
| 71 | 71 | } |
| 72 | 72 | |