@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | $responseData = [ |
125 | 125 | 'error' => $e->getError() |
126 | 126 | ]; |
127 | - if($e->getErrorDescription()) { |
|
127 | + if ($e->getErrorDescription()) { |
|
128 | 128 | $responseData['error_description'] = $e->getErrorDescription(); |
129 | 129 | } |
130 | - if($e->getErrorUri()) { |
|
130 | + if ($e->getErrorUri()) { |
|
131 | 131 | $responseData['error_uri'] = $e->getErrorUri(); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - if(!empty($this->state)) { |
|
135 | + if (!empty($this->state)) { |
|
136 | 136 | $responseData['state'] = $this->state; |
137 | 137 | } |
138 | 138 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | $supportedResponseTypes = $this->client->getMetadata()->getResponseTypes() ?: ['code']; |
173 | 173 | foreach (explode(' ', $requestData['response_type']) as $responseType) { |
174 | - if(!in_array($responseType, $supportedResponseTypes)) { |
|
174 | + if (!in_array($responseType, $supportedResponseTypes)) { |
|
175 | 175 | throw new OAuthException('unsupported_response_type', |
176 | 176 | 'The authorization server does not support obtaining an authorization code using this method.', |
177 | 177 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | try { |
221 | 221 | $redirectUri = new Uri($redirectUri); |
222 | - if($redirectUri->getFragment()) { |
|
222 | + if ($redirectUri->getFragment()) { |
|
223 | 223 | throw new \InvalidArgumentException('The endpoint URI must not include a fragment component.'); |
224 | 224 | } |
225 | 225 | $this->redirectUri = $redirectUri; |
@@ -207,12 +207,10 @@ discard block |
||
207 | 207 | throw new OAuthException('invalid_request', 'The request includes the invalid parameter redirect_uri.', |
208 | 208 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
209 | 209 | } |
210 | - } |
|
211 | - else { |
|
210 | + } else { |
|
212 | 211 | if (count($redirectUris) == 1) { |
213 | 212 | $redirectUri = $redirectUris[0]; |
214 | - } |
|
215 | - else { |
|
213 | + } else { |
|
216 | 214 | throw new OAuthException('invalid_request', 'The request is missing the required parameter redirect_uri.', |
217 | 215 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
218 | 216 | } |
@@ -223,8 +221,7 @@ discard block |
||
223 | 221 | throw new \InvalidArgumentException('The endpoint URI must not include a fragment component.'); |
224 | 222 | } |
225 | 223 | $this->redirectUri = $redirectUri; |
226 | - } |
|
227 | - catch (\InvalidArgumentException $e) { |
|
224 | + } catch (\InvalidArgumentException $e) { |
|
228 | 225 | throw new OAuthException('invalid_request', 'The request includes the malformed parameter redirect_uri. '.$e->getMessage(), |
229 | 226 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
230 | 227 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function verifyScopes(ClientInterface $client, array $scopes): void |
51 | 51 | { |
52 | - if(empty($scopes)) { |
|
52 | + if (empty($scopes)) { |
|
53 | 53 | throw new OAuthException('invalid_scope', |
54 | 54 | 'The request scope is unknown.', |
55 | 55 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | if ($client instanceof RegisteredClient && is_array($client->getMetadata()->getScope())) { |
59 | 59 | $supportedScopes = explode(' ', $client->getMetadata()->getScope()); |
60 | - if(!empty(array_diff($scopes, $supportedScopes))) { |
|
60 | + if (!empty(array_diff($scopes, $supportedScopes))) { |
|
61 | 61 | throw new OAuthException('invalid_scope', |
62 | 62 | 'The request scope is invalid. Supported scopes : '.$client->getMetadata()->getScope(), |
63 | 63 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |