@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | foreach (self::STORAGES as $name => $class) { |
| 92 | 92 | if (!isset($storages[$name])) { |
| 93 | - throw new \Exception('Missing storage "' . $name . '"'); |
|
| 93 | + throw new \Exception('Missing storage "'.$name.'"'); |
|
| 94 | 94 | } |
| 95 | 95 | if (!is_a($storages[$name], $class)) { |
| 96 | - throw new \Exception('Storage "' . $name . '" must implement interface "' . $class . '"'); |
|
| 96 | + throw new \Exception('Storage "'.$name.'" must implement interface "'.$class.'"'); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | if (array_diff(self::MINIMAL_CONFIG, array_keys($config))) { |
| 101 | - throw new \Exception('Missing minimal configuration. Required : ' . implode(', ', self::MINIMAL_CONFIG)); |
|
| 101 | + throw new \Exception('Missing minimal configuration. Required : '.implode(', ', self::MINIMAL_CONFIG)); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $this->config = array_merge(self::DEFAULT_CONFIG, $config); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function getConfig(string $name) |
| 148 | 148 | { |
| 149 | - if(!isset($this->config[$name])) { |
|
| 149 | + if (!isset($this->config[$name])) { |
|
| 150 | 150 | throw new \Exception('Config with name "'.$name.'" not found'); |
| 151 | 151 | } |
| 152 | 152 | return $this->config[$name]; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | public function authenticate(ServerRequestInterface $request) |
| 393 | 393 | { |
| 394 | 394 | $this->client = $this->guard->authenticate($request); |
| 395 | - return (bool)$this->client; |
|
| 395 | + return (bool) $this->client; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @var AuthenticatorInterface $authenticator |
| 31 | 31 | */ |
| 32 | 32 | foreach ($this->authenticators as $authenticator) { |
| 33 | - if($authenticator->requireAuthentication($client)) { |
|
| 33 | + if ($authenticator->requireAuthentication($client)) { |
|
| 34 | 34 | return true; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @var AuthenticatorInterface $authenticator |
| 44 | 44 | */ |
| 45 | 45 | foreach ($this->authenticators as $authenticator) { |
| 46 | - if($client = $authenticator->authenticate($request)) { |
|
| 46 | + if ($client = $authenticator->authenticate($request)) { |
|
| 47 | 47 | return $client; |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -36,25 +36,25 @@ |
||
| 36 | 36 | public function __construct(string $error, ?string $errorDescription = null, ?string $errorUri = null, int $status = 400, array $headers = []) |
| 37 | 37 | { |
| 38 | 38 | if ($this->containsNotAsciiChar($error)) { |
| 39 | - throw new \Exception('Malformed error type. Expect ascii string. Got : ' . $error); |
|
| 39 | + throw new \Exception('Malformed error type. Expect ascii string. Got : '.$error); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (!in_array($error, self::errors)) { |
| 43 | - throw new \Exception('Unexpected error type. Expect one of : ' . implode(', ', self::errors)); |
|
| 43 | + throw new \Exception('Unexpected error type. Expect one of : '.implode(', ', self::errors)); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $data = ['error' => $error]; |
| 47 | 47 | |
| 48 | 48 | if ($errorDescription) { |
| 49 | 49 | if ($this->containsNotAsciiChar($errorDescription)) { |
| 50 | - throw new \Exception('Malformed error description. Expect ascii string. Got : ' . $errorDescription); |
|
| 50 | + throw new \Exception('Malformed error description. Expect ascii string. Got : '.$errorDescription); |
|
| 51 | 51 | } |
| 52 | 52 | $data['error_description'] = $errorDescription; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ($errorUri) { |
| 56 | 56 | if ($this->containsNotAsciiChar($errorUri)) { |
| 57 | - throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $errorUri); |
|
| 57 | + throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$errorUri); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $data['error_uri'] = $errorDescription; |
@@ -36,18 +36,18 @@ discard block |
||
| 36 | 36 | public function __construct(UriInterface $redirectUri, string $error, ?string $errorDescription = null, ?string $errorUri = null) |
| 37 | 37 | { |
| 38 | 38 | if ($this->containsNotAsciiChar($error)) { |
| 39 | - throw new \Exception('Malformed error type. Expect ascii string. Got : ' . $error); |
|
| 39 | + throw new \Exception('Malformed error type. Expect ascii string. Got : '.$error); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (!in_array($error, self::errors)) { |
| 43 | - throw new \Exception('Unexpected error type. Expect one of : ' . implode(', ', self::errors)); |
|
| 43 | + throw new \Exception('Unexpected error type. Expect one of : '.implode(', ', self::errors)); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $redirectUri = Uri::withQueryValue($redirectUri, 'error', $error); |
| 47 | 47 | |
| 48 | 48 | if ($errorDescription) { |
| 49 | 49 | if ($this->containsNotAsciiChar($errorDescription)) { |
| 50 | - throw new \Exception('Malformed error description. Expect ascii string. Got : ' . $errorDescription); |
|
| 50 | + throw new \Exception('Malformed error description. Expect ascii string. Got : '.$errorDescription); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $redirectUri = Uri::withQueryValue($redirectUri, 'error_description', $errorDescription); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | if ($errorUri) { |
| 57 | 57 | if ($this->containsNotAsciiChar($errorUri)) { |
| 58 | - throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $errorUri); |
|
| 58 | + throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$errorUri); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $redirectUri = Uri::withQueryValue($redirectUri, 'error_uri', $errorUri); |
@@ -96,11 +96,11 @@ |
||
| 96 | 96 | * @throws \Exception |
| 97 | 97 | */ |
| 98 | 98 | public function validate() { |
| 99 | - if(!$this->responseType) { |
|
| 99 | + if (!$this->responseType) { |
|
| 100 | 100 | throw new \Exception('Missing response_type parameter'); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if(!$this->clientId) { |
|
| 103 | + if (!$this->clientId) { |
|
| 104 | 104 | throw new \Exception('Missing client_id parameter'); |
| 105 | 105 | } |
| 106 | 106 | return true; |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | $responseTypes = []; |
| 176 | 176 | foreach (explode(' ', $request->getResponseType()) as $responseTypeRequested) { |
| 177 | 177 | $responseType = $this->server->getResponseType($responseTypeRequested); |
| 178 | - if(!$responseType) { |
|
| 178 | + if (!$responseType) { |
|
| 179 | 179 | return new ErrorResponse($redirectUri, 'unsupported_response_type', 'Invalid response_type parameter', |
| 180 | 180 | 'https://tools.ietf.org/html/rfc6749#section-3.1.1'); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if($responseType->isImplicit()) { |
|
| 183 | + if ($responseType->isImplicit()) { |
|
| 184 | 184 | $isImplicitResponseType = true; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $params['state'] = $request->getState(); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - if($isImplicitResponseType) { |
|
| 239 | + if ($isImplicitResponseType) { |
|
| 240 | 240 | $redirectUri = $redirectUri->withFragment(http_build_query($params)); |
| 241 | 241 | } |
| 242 | 242 | else { |
@@ -238,8 +238,7 @@ |
||
| 238 | 238 | |
| 239 | 239 | if($isImplicitResponseType) { |
| 240 | 240 | $redirectUri = $redirectUri->withFragment(http_build_query($params)); |
| 241 | - } |
|
| 242 | - else { |
|
| 241 | + } else { |
|
| 243 | 242 | foreach ($params as $key => $value) { |
| 244 | 243 | $redirectUri = Uri::withQueryValue($redirectUri, $key, $value); |
| 245 | 244 | } |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | try { |
| 168 | 168 | $redirectUri = $grantType->grant($request, $client); |
| 169 | 169 | } |
| 170 | - catch(InvalidGrantType $e) { |
|
| 170 | + catch (InvalidGrantType $e) { |
|
| 171 | 171 | return new ErrorResponse('invalid_grant', $e->getErrorDescription(), $e->getErrorUri()); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -166,8 +166,7 @@ |
||
| 166 | 166 | |
| 167 | 167 | try { |
| 168 | 168 | $redirectUri = $grantType->grant($request, $client); |
| 169 | - } |
|
| 170 | - catch(InvalidGrantType $e) { |
|
| 169 | + } catch(InvalidGrantType $e) { |
|
| 171 | 170 | return new ErrorResponse('invalid_grant', $e->getErrorDescription(), $e->getErrorUri()); |
| 172 | 171 | } |
| 173 | 172 | |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | protected function errorResponse(string $redirectUri, string $error, ?string $description = null, ?string $uri = null) |
| 75 | 75 | { |
| 76 | 76 | if ($this->containsNotAsciiChar($error)) { |
| 77 | - throw new \Exception('Malformed error type. Expect ascii string. Got : ' . $error); |
|
| 77 | + throw new \Exception('Malformed error type. Expect ascii string. Got : '.$error); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if (!in_array($error, self::errors)) { |
| 81 | - throw new \Exception('Unexpected error type. Expect one of : ' . implode(', ', self::errors)); |
|
| 81 | + throw new \Exception('Unexpected error type. Expect one of : '.implode(', ', self::errors)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $data = ['error' => $error]; |
| 85 | 85 | |
| 86 | 86 | if ($description) { |
| 87 | 87 | if ($this->containsNotAsciiChar($description)) { |
| 88 | - throw new \Exception('Malformed error description. Expect ascii string. Got : ' . $description); |
|
| 88 | + throw new \Exception('Malformed error description. Expect ascii string. Got : '.$description); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $data['error_description'] = $description; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | if ($uri) { |
| 95 | 95 | if ($this->containsNotAsciiChar($uri)) { |
| 96 | - throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $uri); |
|
| 96 | + throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$uri); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $data['error_uri'] = $uri; |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | $redirectUri = new Uri($redirectUri); |
| 103 | 103 | $query = http_build_query($data); |
| 104 | 104 | if ($redirectUri->getQuery()) { |
| 105 | - $query .= '&' . $redirectUri->getQuery(); |
|
| 105 | + $query .= '&'.$redirectUri->getQuery(); |
|
| 106 | 106 | } |
| 107 | - $redirectUri = $redirectUri->getScheme() . ':' . $redirectUri->getHierPart() . '?' . $query; |
|
| 107 | + $redirectUri = $redirectUri->getScheme().':'.$redirectUri->getHierPart().'?'.$query; |
|
| 108 | 108 | |
| 109 | 109 | return $this->redirectResponse($redirectUri); |
| 110 | 110 | } |
@@ -184,11 +184,11 @@ |
||
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | $responseModeIdentifier = $requestData['response_mode'] ?? $this->getResponseType()->getDefaultResponseMode(); |
| 187 | - if(!($responseMode = $this->responseModeManager->getResponseMode($responseModeIdentifier))) { |
|
| 187 | + if (!($responseMode = $this->responseModeManager->getResponseMode($responseModeIdentifier))) { |
|
| 188 | 188 | throw new OAuthException('invalid_request', 'response_mode invalid'); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if(in_array($responseModeIdentifier, $this->getResponseType()->getUnsupportedResponseModes())) { |
|
| 191 | + if (in_array($responseModeIdentifier, $this->getResponseType()->getUnsupportedResponseModes())) { |
|
| 192 | 192 | throw new OAuthException('invalid_request', 'response_mode unsupported'); |
| 193 | 193 | } |
| 194 | 194 | $this->responseMode = $responseMode; |