@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | */ |
19 | -class AmazonEndpoints extends EndpointMap{ |
|
19 | +class AmazonEndpoints extends EndpointMap { |
|
20 | 20 | |
21 | 21 | protected $userProfile = [ |
22 | 22 | 'path' => '/user/profile', |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | namespace chillerlan\OAuth\Providers\Amazon; |
18 | 18 | |
19 | -use chillerlan\OAuth\Core\{CSRFToken, OAuth2Provider, TokenExpires, TokenRefresh,}; |
|
19 | +use chillerlan\OAuth\Core\{CSRFToken, OAuth2Provider, TokenExpires, TokenRefresh, }; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @method \Psr\Http\Message\ResponseInterface userProfile() |
@@ -116,7 +116,7 @@ |
||
116 | 116 | public function setInstance(string $instance):Mastodon{ |
117 | 117 | $instance = parse_url($instance); |
118 | 118 | |
119 | - if(!isset($instance['scheme']) || !isset($instance['host'])){ |
|
119 | + if (!isset($instance['scheme']) || !isset($instance['host'])) { |
|
120 | 120 | throw new OAuthException('invalid instance URL'); |
121 | 121 | } |
122 | 122 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @link https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md |
19 | 19 | */ |
20 | -class MastodonEndpoints extends EndpointMap{ |
|
20 | +class MastodonEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | protected $getCurrentUser = [ |
23 | 23 | 'path' => '/v1/accounts/verify_credentials', |
@@ -45,7 +45,7 @@ |
||
45 | 45 | * @method \Psr\Http\Message\ResponseInterface updateDiscount(string $account_id, string $discount_id, array $body = ['type', 'name', 'code', 'active_at', 'expires_at', 'requirement_type', 'expiration_type', 'reward_type', 'application_type', 'percent_discount', 'flat_rate_discount', 'use_limit', 'minimum_cart_total', 'minimum_cart_quantity']) |
46 | 46 | * @method \Psr\Http\Message\ResponseInterface updateOrder(string $account_id, string $order_id, array $body = ['id', 'type', 'customer_first_name', 'customer_last_name', 'customer_email', 'shipping_address_1', 'shipping_address_2', 'shipping_city', 'shipping_state', 'shipping_zip', 'shipping_country_id', 'shipping_status']) |
47 | 47 | */ |
48 | -class BigCartel extends OAuth2Provider implements CSRFToken{ |
|
48 | +class BigCartel extends OAuth2Provider implements CSRFToken { |
|
49 | 49 | |
50 | 50 | protected $apiURL = 'https://api.bigcartel.com/v1'; |
51 | 51 | protected $authURL = 'https://my.bigcartel.com/oauth/authorize'; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @link https://developers.bigcartel.com/api/v1 |
19 | 19 | */ |
20 | -class BigCartelEndpoints extends EndpointMap{ |
|
20 | +class BigCartelEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Account |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | use chillerlan\HTTP\MagicAPI\EndpointMap; |
19 | 19 | |
20 | -class MusicBrainzEndpoints extends EndpointMap{ |
|
20 | +class MusicBrainzEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * oauth2 |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function refreshAccessToken(AccessToken $token = null):AccessToken{ |
83 | 83 | |
84 | - if($token === null){ |
|
84 | + if ($token === null) { |
|
85 | 85 | $token = $this->storage->getAccessToken($this->serviceName); |
86 | 86 | } |
87 | 87 | |
88 | 88 | $refreshToken = $token->refreshToken; |
89 | 89 | |
90 | - if(empty($refreshToken)){ |
|
90 | + if (empty($refreshToken)) { |
|
91 | 91 | throw new ProviderException(\sprintf('no refresh token available, token expired [%s]', \date('Y-m-d h:i:s A', $token->expires))); |
92 | 92 | } |
93 | 93 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $newToken = $this->parseTokenResponse($this->http->sendRequest($request)); |
109 | 109 | |
110 | - if(empty($newToken->refreshToken)){ |
|
110 | + if (empty($newToken->refreshToken)) { |
|
111 | 111 | $newToken->refreshToken = $refreshToken; |
112 | 112 | } |
113 | 113 | |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | $method = \strtoupper($method); |
131 | 131 | $token = $this->storage->getAccessToken($this->serviceName); |
132 | 132 | |
133 | - if($token->isExpired()){ |
|
133 | + if ($token->isExpired()) { |
|
134 | 134 | $token = $this->refreshAccessToken($token); |
135 | 135 | } |
136 | 136 | |
137 | - if(!isset($params['fmt'])){ |
|
137 | + if (!isset($params['fmt'])) { |
|
138 | 138 | $params['fmt'] = 'json'; |
139 | 139 | } |
140 | 140 | |
141 | - if(\in_array($method, ['POST', 'PUT', 'DELETE']) && !isset($params['client'])){ |
|
141 | + if (\in_array($method, ['POST', 'PUT', 'DELETE']) && !isset($params['client'])) { |
|
142 | 142 | $params['client'] = $this->options->user_agent; |
143 | 143 | } |
144 | 144 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @method \Psr\Http\Message\ResponseInterface ping() |
28 | 28 | * @method \Psr\Http\Message\ResponseInterface root(array $params = ['fields', 'exclude_fields']) |
29 | 29 | */ |
30 | -class MailChimp extends OAuth2Provider implements CSRFToken{ |
|
30 | +class MailChimp extends OAuth2Provider implements CSRFToken { |
|
31 | 31 | |
32 | 32 | protected const API_BASE = 'https://%s.api.mailchimp.com/3.0'; |
33 | 33 | protected const METADATA_ENDPOINT = 'https://login.mailchimp.com/oauth2/metadata'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | ? $token |
52 | 52 | : $this->storage->getAccessToken($this->serviceName); |
53 | 53 | |
54 | - if(!$token instanceof AccessToken){ |
|
54 | + if (!$token instanceof AccessToken) { |
|
55 | 55 | throw new OAuthException('invalid token'); // @codeCoverageIgnore |
56 | 56 | } |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $response = $this->http->sendRequest($request); |
64 | 64 | |
65 | - if($response->getStatusCode() !== 200){ |
|
65 | + if ($response->getStatusCode() !== 200) { |
|
66 | 66 | throw new OAuthException('metadata response error'); // @codeCoverageIgnore |
67 | 67 | } |
68 | 68 |