@@ -20,7 +20,7 @@ |
||
20 | 20 | * @method \Psr\Http\Message\ResponseInterface me() |
21 | 21 | * @method \Psr\Http\Message\ResponseInterface user(string $username) |
22 | 22 | */ |
23 | -class Mixcloud extends OAuth2Provider{ |
|
23 | +class Mixcloud extends OAuth2Provider { |
|
24 | 24 | |
25 | 25 | protected string $authURL = 'https://www.mixcloud.com/oauth/authorize'; |
26 | 26 | protected string $accessTokenURL = 'https://www.mixcloud.com/oauth/access_token'; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * |
21 | 21 | * note: a missing slash at the end of the path will end up in a HTTP/301 |
22 | 22 | */ |
23 | -class MixcloudEndpoints extends EndpointMap{ |
|
23 | +class MixcloudEndpoints extends EndpointMap { |
|
24 | 24 | |
25 | 25 | protected array $me = [ |
26 | 26 | 'path' => '/me/', |
@@ -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 string $authURL = 'https://my.bigcartel.com/oauth/authorize'; |
51 | 51 | protected string $accessTokenURL = 'https://api.bigcartel.com/oauth/token'; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @link https://develop.battle.net/documentation/api-reference |
19 | 19 | */ |
20 | -class BattleNetEndpoints extends EndpointMap{ |
|
20 | +class BattleNetEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | protected array $userinfo = [ |
23 | 23 | 'path' => '/oauth/userinfo', |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * @link https://api.slack.com/docs/conversations-api |
23 | 23 | * @link https://api.slack.com/rtm |
24 | 24 | */ |
25 | -class SlackEndpoints extends EndpointMap{ |
|
25 | +class SlackEndpoints extends EndpointMap { |
|
26 | 26 | |
27 | 27 | protected array $userIdentity = [ |
28 | 28 | 'path' => '/users.identity', |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @link https://docs.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0 |
19 | 19 | */ |
20 | -class MicrosoftGraphEndpoints extends EndpointMap{ |
|
20 | +class MicrosoftGraphEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | protected string $API_BASE = '/v1.0'; |
23 | 23 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
16 | 16 | |
17 | -class FlickrEndpoints extends EndpointMap{ |
|
17 | +class FlickrEndpoints extends EndpointMap { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @link https://www.flickr.com/services/api/flickr.activity.userComments.html |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | */ |
19 | -class BitbucketEndpoints extends EndpointMap{ |
|
19 | +class BitbucketEndpoints extends EndpointMap { |
|
20 | 20 | |
21 | 21 | protected string $API_BASE = '/2.0'; |
22 | 22 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use chillerlan\OAuth\Core\{AccessToken, OAuthProvider, ProviderException}; |
18 | 18 | use Psr\Http\Message\{RequestInterface, ResponseInterface, UriInterface}; |
19 | 19 | |
20 | -use function array_merge, http_build_query, in_array, is_array,ksort, md5; |
|
20 | +use function array_merge, http_build_query, in_array, is_array, ksort, md5; |
|
21 | 21 | use function chillerlan\HTTP\Psr7\{get_json, merge_query}; |
22 | 22 | |
23 | 23 | use const PHP_QUERY_RFC1738; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @method \Psr\Http\Message\ResponseInterface userGetWeeklyArtistChart(array $params = ['user', 'from', 'to']) |
77 | 77 | * @method \Psr\Http\Message\ResponseInterface userGetWeeklyTrackChart(array $params = ['user', 'from', 'to']) |
78 | 78 | */ |
79 | -class LastFM extends OAuthProvider{ |
|
79 | +class LastFM extends OAuthProvider { |
|
80 | 80 | |
81 | 81 | public const PERIOD_OVERALL = 'overall'; |
82 | 82 | public const PERIOD_7DAY = '7day'; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | self::PERIOD_12MONTH, |
95 | 95 | ]; |
96 | 96 | |
97 | - protected string $authURL = 'https://www.last.fm/api/auth'; |
|
97 | + protected string $authURL = 'https://www.last.fm/api/auth'; |
|
98 | 98 | protected ?string $apiURL = 'https://ws.audioscrobbler.com/2.0'; |
99 | 99 | protected ?string $userRevokeURL = 'https://www.last.fm/settings/applications'; |
100 | 100 | protected ?string $endpointMap = LastFMEndpoints::class; |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | |
124 | 124 | $signature = ''; |
125 | 125 | |
126 | - foreach($params as $k => $v){ |
|
127 | - if(!in_array($k, ['format', 'callback'])){ |
|
126 | + foreach ($params as $k => $v) { |
|
127 | + if (!in_array($k, ['format', 'callback'])) { |
|
128 | 128 | $signature .= $k.$v; |
129 | 129 | } |
130 | 130 | } |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
164 | 164 | $data = get_json($response, true); |
165 | 165 | |
166 | - if(!$data || !is_array($data)){ |
|
166 | + if (!$data || !is_array($data)) { |
|
167 | 167 | throw new ProviderException('unable to parse token response'); |
168 | 168 | } |
169 | - elseif(isset($data['error'])){ |
|
169 | + elseif (isset($data['error'])) { |
|
170 | 170 | throw new ProviderException('error retrieving access token: '.$data['message']); |
171 | 171 | } |
172 | - elseif(!isset($data['session']['key'])){ |
|
172 | + elseif (!isset($data['session']['key'])) { |
|
173 | 173 | throw new ProviderException('token missing'); |
174 | 174 | } |
175 | 175 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $method ??= 'GET'; |
223 | 223 | $params = $this->requestParams($path, $params ?? [], $body ?? []); |
224 | 224 | |
225 | - if($method === 'POST'){ |
|
225 | + if ($method === 'POST') { |
|
226 | 226 | $body = $params; |
227 | 227 | $params = []; |
228 | 228 | } |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | /** @phan-suppress-next-line PhanTypeMismatchArgumentNullable */ |
231 | 231 | $request = $this->requestFactory->createRequest($method, merge_query($this->apiURL, $params)); |
232 | 232 | |
233 | - foreach(array_merge($this->apiHeaders, $headers ?? []) as $header => $value){ |
|
233 | + foreach (array_merge($this->apiHeaders, $headers ?? []) as $header => $value) { |
|
234 | 234 | $request = $request->withAddedHeader($header, $value); |
235 | 235 | } |
236 | 236 | |
237 | - if($method === 'POST'){ |
|
237 | + if ($method === 'POST') { |
|
238 | 238 | $request = $request->withHeader('Content-Type', 'application/x-www-form-urlencoded'); |
239 | 239 | $body = $this->streamFactory->createStream(http_build_query($body, '', '&', PHP_QUERY_RFC1738)); |
240 | 240 | $request = $request->withBody($body); |