@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | protected function getRequestTarget(string $uri):string{ |
57 | 57 | $parsedURL = parse_url($uri); |
58 | 58 | |
59 | - if(!isset($parsedURL['path'])){ |
|
59 | + if (!isset($parsedURL['path'])) { |
|
60 | 60 | throw new ProviderException('invalid path'); // @codeCoverageIgnore |
61 | 61 | } |
62 | 62 | |
63 | 63 | // for some reason we were given a host name |
64 | - if(isset($parsedURL['host'])){ |
|
64 | + if (isset($parsedURL['host'])) { |
|
65 | 65 | |
66 | 66 | // back out if it doesn't match |
67 | - if(strpos($parsedURL['host'], '.api.npr.org') === false){ |
|
67 | + if (strpos($parsedURL['host'], '.api.npr.org') === false) { |
|
68 | 68 | throw new ProviderException('given host does not match provider host'); // @codeCoverageIgnore |
69 | 69 | } |
70 | 70 | |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | public function sendRequest(RequestInterface $request):ResponseInterface{ |
83 | 83 | |
84 | 84 | // get authorization only if we request the provider API |
85 | - if(strpos((string)$request->getUri(), '.api.npr.org') !== false){ |
|
85 | + if (strpos((string)$request->getUri(), '.api.npr.org') !== false) { |
|
86 | 86 | $token = $this->storage->getAccessToken($this->serviceName); |
87 | 87 | |
88 | 88 | // attempt to refresh an expired token |
89 | - if( |
|
89 | + if ( |
|
90 | 90 | $this->options->tokenAutoRefresh |
91 | 91 | && ($token->isExpired() || $token->expires === $token::EOL_UNKNOWN) |
92 | - ){ |
|
92 | + ) { |
|
93 | 93 | $token = $this->refreshAccessToken($token); // @codeCoverageIgnore |
94 | 94 | } |
95 | 95 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | protected array $authHeaders = ['Accept' => 'application/vnd.twitchtv.v5+json']; |
116 | 116 | protected array $apiHeaders = ['Accept' => 'application/vnd.twitchtv.v5+json']; |
117 | 117 | |
118 | - protected array $defaultScopes = [ |
|
118 | + protected array $defaultScopes = [ |
|
119 | 119 | self::SCOPE_USER_READ_EMAIL, |
120 | 120 | ]; |
121 | 121 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | 'grant_type' => 'client_credentials', |
134 | 134 | ]; |
135 | 135 | |
136 | - if($scopes !== null){ |
|
136 | + if ($scopes !== null) { |
|
137 | 137 | $params['scope'] = implode($this->scopesDelimiter, $scopes); |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ->withBody($this->streamFactory->createStream(http_build_query($params, '', '&', PHP_QUERY_RFC1738))) |
144 | 144 | ; |
145 | 145 | |
146 | - foreach($this->authHeaders as $header => $value){ |
|
146 | + foreach ($this->authHeaders as $header => $value) { |
|
147 | 147 | $request = $request->withAddedHeader($header, $value); |
148 | 148 | } |
149 | 149 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
13 | 13 | |
14 | -class TwitchEndpoints extends EndpointMap{ |
|
14 | +class TwitchEndpoints extends EndpointMap { |
|
15 | 15 | |
16 | 16 | protected string $API_BASE = '/helix'; |
17 | 17 |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function setInstance(string $instance):Mastodon{ |
120 | 120 | $instance = parse_url($instance); |
121 | 121 | |
122 | - if(!isset($instance['scheme']) || !isset($instance['host'])){ |
|
122 | + if (!isset($instance['scheme']) || !isset($instance['host'])) { |
|
123 | 123 | throw new OAuthException('invalid instance URL'); |
124 | 124 | } |
125 | 125 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ->withHeader('Accept-Encoding', 'identity') |
156 | 156 | ->withBody($this->streamFactory->createStream(http_build_query($body, '', '&', PHP_QUERY_RFC1738))); |
157 | 157 | |
158 | - foreach($this->authHeaders as $header => $value){ |
|
158 | + foreach ($this->authHeaders as $header => $value) { |
|
159 | 159 | $request = $request->withHeader($header, $value); |
160 | 160 | } |
161 | 161 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
13 | 13 | |
14 | -class SpotifyEndpoints extends EndpointMap{ |
|
14 | +class SpotifyEndpoints extends EndpointMap { |
|
15 | 15 | |
16 | 16 | protected string $API_BASE = '/v1'; |
17 | 17 |
@@ -124,7 +124,7 @@ |
||
124 | 124 | protected array $authHeaders = ['Accept' => 'application/vnd.vimeo.*+json;version='.self::API_VERSION]; |
125 | 125 | protected array $apiHeaders = ['Accept' => 'application/vnd.vimeo.*+json;version='.self::API_VERSION]; |
126 | 126 | |
127 | - protected array $defaultScopes = [ |
|
127 | + protected array $defaultScopes = [ |
|
128 | 128 | self::SCOPE_PRIVATE, |
129 | 129 | self::SCOPE_INTERACT, |
130 | 130 | ]; |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | use chillerlan\OAuth\MagicAPI\EndpointMap; |
13 | 13 | |
14 | -class OpenCachingEndpoints extends EndpointMap{ |
|
14 | +class OpenCachingEndpoints extends EndpointMap { |
|
15 | 15 | |
16 | 16 | protected string $API_BASE = '/services'; |
17 | 17 |