@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @method \Psr\Http\Message\ResponseInterface memberId(string $member_id, array $params = ['fields[member]', 'fields[tier]', 'fields[user]']) |
24 | 24 | * @method \Psr\Http\Message\ResponseInterface webhooks(array $params = ['fields[webhook]']) |
25 | 25 | */ |
26 | -class Patreon2 extends PatreonAbstract{ |
|
26 | +class Patreon2 extends PatreonAbstract { |
|
27 | 27 | |
28 | 28 | // wow, consistency... |
29 | 29 | public const SCOPE_IDENTITY = 'identity'; |
@@ -35,6 +35,6 @@ discard block |
||
35 | 35 | public const SCOPE_CAMPAIGNS_MEMBERS_EMAIL = 'campaigns.members[email]'; |
36 | 36 | public const SCOPE_CAMPAIGNS_MEMBERS_ADDRESS = 'campaigns.members.address'; |
37 | 37 | |
38 | - protected $endpointMap = Patreon2Endpoints::class; |
|
38 | + protected $endpointMap = Patreon2Endpoints::class; |
|
39 | 39 | |
40 | 40 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | */ |
19 | -class Patreon2Endpoints extends EndpointMap{ |
|
19 | +class Patreon2Endpoints extends EndpointMap { |
|
20 | 20 | |
21 | 21 | protected $API_BASE = '/v2'; |
22 | 22 |
@@ -20,12 +20,12 @@ |
||
20 | 20 | * @method \Psr\Http\Message\ResponseInterface currentUser() |
21 | 21 | * @method \Psr\Http\Message\ResponseInterface currentUserCampaigns(array $params = ['includes']) |
22 | 22 | */ |
23 | -class Patreon1 extends PatreonAbstract{ |
|
23 | +class Patreon1 extends PatreonAbstract { |
|
24 | 24 | |
25 | 25 | public const SCOPE_USERS = 'users'; |
26 | 26 | public const SCOPE_PLEDGES_TO_ME = 'pledges-to-me'; |
27 | 27 | public const SCOPE_MY_CAMPAIGN = 'my-campaign'; |
28 | 28 | |
29 | - protected $endpointMap = Patreon1Endpoints::class; |
|
29 | + protected $endpointMap = Patreon1Endpoints::class; |
|
30 | 30 | |
31 | 31 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | */ |
19 | -class Patreon1Endpoints extends EndpointMap{ |
|
19 | +class Patreon1Endpoints extends EndpointMap { |
|
20 | 20 | |
21 | 21 | protected $API_BASE = '/api'; |
22 | 22 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @method \Psr\Http\Message\ResponseInterface userGetWeeklyArtistChart(array $params = ['user', 'from', 'to']) |
73 | 73 | * @method \Psr\Http\Message\ResponseInterface userGetWeeklyTrackChart(array $params = ['user', 'from', 'to']) |
74 | 74 | */ |
75 | -class LastFM extends OAuthProvider{ |
|
75 | +class LastFM extends OAuthProvider { |
|
76 | 76 | |
77 | 77 | public const PERIOD_OVERALL = 'overall'; |
78 | 78 | public const PERIOD_7DAY = '7day'; |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | $signature = ''; |
121 | 121 | |
122 | - foreach($params as $k => $v){ |
|
123 | - if(!\in_array($k, ['format', 'callback'])){ |
|
122 | + foreach ($params as $k => $v) { |
|
123 | + if (!\in_array($k, ['format', 'callback'])) { |
|
124 | 124 | $signature .= $k.$v; |
125 | 125 | } |
126 | 126 | } |
@@ -158,13 +158,13 @@ discard block |
||
158 | 158 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
159 | 159 | $data = Psr7\get_json($response, true); |
160 | 160 | |
161 | - if(!$data || !\is_array($data)){ |
|
161 | + if (!$data || !\is_array($data)) { |
|
162 | 162 | throw new ProviderException('unable to parse token response'); |
163 | 163 | } |
164 | - elseif(isset($data['error'])){ |
|
164 | + elseif (isset($data['error'])) { |
|
165 | 165 | throw new ProviderException('error retrieving access token: '.$data['message']); |
166 | 166 | } |
167 | - elseif(!isset($data['session']['key'])){ |
|
167 | + elseif (!isset($data['session']['key'])) { |
|
168 | 168 | throw new ProviderException('token missing'); |
169 | 169 | } |
170 | 170 | |
@@ -217,18 +217,18 @@ discard block |
||
217 | 217 | $method = $method ?? 'GET'; |
218 | 218 | $params = $this->requestParams($path, $params ?? [], $body ?? []); |
219 | 219 | |
220 | - if($method === 'POST'){ |
|
220 | + if ($method === 'POST') { |
|
221 | 221 | $body = $params; |
222 | 222 | $params = []; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $request = $this->requestFactory->createRequest($method, Psr7\merge_query($this->apiURL, $params)); |
226 | 226 | |
227 | - foreach(\array_merge($this->apiHeaders, $headers ?? []) as $header => $value){ |
|
227 | + foreach (\array_merge($this->apiHeaders, $headers ?? []) as $header => $value) { |
|
228 | 228 | $request = $request->withAddedHeader($header, $value); |
229 | 229 | } |
230 | 230 | |
231 | - if($method === 'POST'){ |
|
231 | + if ($method === 'POST') { |
|
232 | 232 | $request = $request->withHeader('Content-Type', 'application/x-www-form-urlencoded'); |
233 | 233 | $body = $this->streamFactory->createStream(\http_build_query($body, '', '&', \PHP_QUERY_RFC1738)); |
234 | 234 | $request = $request->withBody($body); |
@@ -160,11 +160,9 @@ |
||
160 | 160 | |
161 | 161 | if(!$data || !\is_array($data)){ |
162 | 162 | throw new ProviderException('unable to parse token response'); |
163 | - } |
|
164 | - elseif(isset($data['error'])){ |
|
163 | + } elseif(isset($data['error'])){ |
|
165 | 164 | throw new ProviderException('error retrieving access token: '.$data['message']); |
166 | - } |
|
167 | - elseif(!isset($data['session']['key'])){ |
|
165 | + } elseif(!isset($data['session']['key'])){ |
|
168 | 166 | throw new ProviderException('token missing'); |
169 | 167 | } |
170 | 168 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | * @todo hellooo??? https://twitter.com/codemasher/status/982315427308146689 |
21 | 21 | */ |
22 | -class LastFMEndpoints extends EndpointMap{ |
|
22 | +class LastFMEndpoints extends EndpointMap { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @link https://www.last.fm/api/show/album.addTags |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @link https://developer.gitter.im/docs/rest-api |
19 | 19 | */ |
20 | -class GitterEndpoints extends EndpointMap{ |
|
20 | +class GitterEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | protected $me = [ |
23 | 23 | 'path' => '/user/me', |
@@ -67,12 +67,12 @@ |
||
67 | 67 | * |
68 | 68 | * |
69 | 69 | */ |
70 | -class SoundCloudEndpoints extends EndpointMap{ |
|
70 | +class SoundCloudEndpoints extends EndpointMap { |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * @link |
74 | 74 | */ |
75 | - protected $me = [ |
|
75 | + protected $me = [ |
|
76 | 76 | 'path' => '/me', |
77 | 77 | 'method' => 'GET', |
78 | 78 | 'query' => [], |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @method \Psr\Http\Message\ResponseInterface me() |
22 | 22 | * @method \Psr\Http\Message\ResponseInterface user(string $id) |
23 | 23 | */ |
24 | -class SoundCloud extends OAuth2Provider implements TokenExpires{ |
|
24 | +class SoundCloud extends OAuth2Provider implements TokenExpires { |
|
25 | 25 | |
26 | 26 | public const SCOPE_NONEXPIRING = 'non-expiring'; |
27 | 27 | # public const SCOPE_EMAIL = 'email'; // ??? |