@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\HTTP\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 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @link https://www.instagram.com/developer/endpoints/ |
19 | 19 | */ |
20 | -class InstagramEndpoints extends EndpointMap{ |
|
20 | +class InstagramEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @link |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @method \Psr\Http\Message\ResponseInterface tags(string $tagname) |
44 | 44 | * @method \Psr\Http\Message\ResponseInterface tagsRecentMedia(string $tagname, array $params = ['max_tag_id', 'min_tag_id', 'count']) |
45 | 45 | */ |
46 | -class Instagram extends OAuth2Provider implements CSRFToken{ |
|
46 | +class Instagram extends OAuth2Provider implements CSRFToken { |
|
47 | 47 | |
48 | 48 | public const SCOPE_BASIC = 'basic'; |
49 | 49 | public const SCOPE_COMMENTS = 'comments'; |
@@ -19,12 +19,12 @@ |
||
19 | 19 | /** |
20 | 20 | * @todo |
21 | 21 | */ |
22 | -class GitHubEndpoints extends EndpointMap{ |
|
22 | +class GitHubEndpoints extends EndpointMap { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @link https://developer.github.com/v3/users/#get-the-authenticated-user |
26 | 26 | */ |
27 | - protected $me = [ |
|
27 | + protected $me = [ |
|
28 | 28 | 'path' => '/user', |
29 | 29 | 'method' => 'GET', |
30 | 30 | 'query' => [], |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @method \Psr\Http\Message\ResponseInterface getUser(string $username) |
22 | 22 | * @method \Psr\Http\Message\ResponseInterface me() |
23 | 23 | */ |
24 | -class GitHub extends OAuth2Provider implements CSRFToken{ |
|
24 | +class GitHub extends OAuth2Provider implements CSRFToken { |
|
25 | 25 | |
26 | 26 | const SCOPE_USER = 'user'; |
27 | 27 | const SCOPE_USER_EMAIL = 'user:email'; |
@@ -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; // @codeCoverageIgnore |
143 | 143 | } |
144 | 144 |
@@ -243,7 +243,7 @@ |
||
243 | 243 | * @method \Psr\Http\Message\ResponseInterface urlsLookupGroup(array $params = ['url']) |
244 | 244 | * @method \Psr\Http\Message\ResponseInterface urlsLookupUser(array $params = ['url']) |
245 | 245 | */ |
246 | -class Flickr extends OAuth1Provider{ |
|
246 | +class Flickr extends OAuth1Provider { |
|
247 | 247 | |
248 | 248 | public const PERM_READ = 'read'; |
249 | 249 | public const PERM_WRITE = 'write'; |
@@ -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'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $token = $token ?? $this->storage->getAccessToken($this->serviceName); |
51 | 51 | |
52 | - if(!$token instanceof AccessToken){ |
|
52 | + if (!$token instanceof AccessToken) { |
|
53 | 53 | throw new OAuthException('invalid token'); // @codeCoverageIgnore |
54 | 54 | } |
55 | 55 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $response = $this->http->sendRequest($request); |
62 | 62 | |
63 | - if($response->getStatusCode() !== 200){ |
|
63 | + if ($response->getStatusCode() !== 200) { |
|
64 | 64 | throw new OAuthException('metadata response error'); // @codeCoverageIgnore |
65 | 65 | } |
66 | 66 |