@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $payload = json_decode((string) $response->getBody(), true); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if (! is_array($payload)) { |
|
| 107 | + if (!is_array($payload)) { |
|
| 108 | 108 | throw new RuntimeException('Unable to parse userinfo claims'); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | // check expected sub |
| 118 | 118 | $expectedSub = $tokenSet->claims()['sub'] ?? null; |
| 119 | 119 | |
| 120 | - if (! $expectedSub) { |
|
| 120 | + if (!$expectedSub) { |
|
| 121 | 121 | throw new RuntimeException('Unable to get sub claim from id_token'); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | 'redirect_uri' => $clientMetadata->getRedirectUris()[0] ?? null, |
| 103 | 103 | ], $params); |
| 104 | 104 | |
| 105 | - $params = array_filter($params, static function ($value) { |
|
| 105 | + $params = array_filter($params, static function($value) { |
|
| 106 | 106 | return null !== $value; |
| 107 | 107 | }); |
| 108 | 108 | |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | unset($params[$key]); |
| 112 | 112 | } elseif ('claims' === $key && (is_array($value) || $value instanceof JsonSerializable)) { |
| 113 | 113 | $params['claims'] = json_encode($value); |
| 114 | - } elseif (! is_string($value)) { |
|
| 114 | + } elseif (!is_string($value)) { |
|
| 115 | 115 | $params[$key] = (string) $value; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if (! array_key_exists('nonce', $params) && 'code' !== ($params['response_type'] ?? '')) { |
|
| 119 | + if (!array_key_exists('nonce', $params) && 'code' !== ($params['response_type'] ?? '')) { |
|
| 120 | 120 | throw new InvalidArgumentException('nonce MUST be provided for implicit and hybrid flows'); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $data = parse_metadata_response($response, 201); |
| 88 | 88 | |
| 89 | - if (! array_key_exists('client_id', $data)) { |
|
| 89 | + if (!array_key_exists('client_id', $data)) { |
|
| 90 | 90 | throw new RuntimeException('Registration response did not return a client_id field'); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $claims = parse_metadata_response($response, 200); |
| 109 | 109 | |
| 110 | - if (! array_key_exists('client_id', $claims)) { |
|
| 110 | + if (!array_key_exists('client_id', $claims)) { |
|
| 111 | 111 | throw new RuntimeException('Registration response did not return a client_id field'); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $data = parse_metadata_response($response, 200); |
| 147 | 147 | |
| 148 | - if (! array_key_exists('client_id', $data)) { |
|
| 148 | + if (!array_key_exists('client_id', $data)) { |
|
| 149 | 149 | throw new RuntimeException('Registration response did not return a client_id field'); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 40 | 40 | { |
| 41 | - if (! class_exists(Cookies::class)) { |
|
| 41 | + if (!class_exists(Cookies::class)) { |
|
| 42 | 42 | throw new LogicException('To use the SessionCookieMiddleware you should install dflydev/fig-cookies package'); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $cookieValue = null !== $sessionCookie ? $sessionCookie->getValue() : null; |
| 49 | 49 | $data = null !== $cookieValue ? json_decode($cookieValue, true) : []; |
| 50 | 50 | |
| 51 | - if (! is_array($data)) { |
|
| 51 | + if (!is_array($data)) { |
|
| 52 | 52 | $data = []; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | $client = $this->client ?: $request->getAttribute(ClientInterface::class); |
| 46 | 46 | $authSession = $request->getAttribute(AuthSessionInterface::class); |
| 47 | 47 | |
| 48 | - if (! $client instanceof ClientInterface) { |
|
| 48 | + if (!$client instanceof ClientInterface) { |
|
| 49 | 49 | throw new LogicException('No OpenID client provided'); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if (null !== $authSession && ! $client instanceof AuthSessionInterface) { |
|
| 52 | + if (null !== $authSession && !$client instanceof AuthSessionInterface) { |
|
| 53 | 53 | throw new LogicException('Invalid auth session provided in attribute ' . AuthSessionInterface::class); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -580,7 +580,7 @@ |
||
| 580 | 580 | */ |
| 581 | 581 | private function getFilteredClaims(): array |
| 582 | 582 | { |
| 583 | - return array_filter($this->metadata, static function ($value, string $key) { |
|
| 583 | + return array_filter($this->metadata, static function($value, string $key) { |
|
| 584 | 584 | return array_key_exists($key, static::$requiredKeys) |
| 585 | 585 | || $value !== (static::$defaults[$key] ?? null); |
| 586 | 586 | }, ARRAY_FILTER_USE_BOTH); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | : $resource |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - if (! is_array($parsedUrl) || ! array_key_exists('host', $parsedUrl)) { |
|
| 72 | + if (!is_array($parsedUrl) || !array_key_exists('host', $parsedUrl)) { |
|
| 73 | 73 | throw new RuntimeException('Unable to parse resource'); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $links = $data['links'] ?? []; |
| 98 | 98 | $href = null; |
| 99 | 99 | foreach ($links as $link) { |
| 100 | - if (! is_array($link)) { |
|
| 100 | + if (!is_array($link)) { |
|
| 101 | 101 | continue; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | continue; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (! array_key_exists('href', $link)) { |
|
| 108 | + if (!array_key_exists('href', $link)) { |
|
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $href = $link['href']; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if (! is_string($href) || 0 !== strpos($href, 'https://')) { |
|
| 115 | + if (!is_string($href) || 0 !== strpos($href, 'https://')) { |
|
| 116 | 116 | throw new InvalidArgumentException('Invalid issuer location'); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | throw new RuntimeException('Unable to fetch provider metadata', 0, $e); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! array_key_exists('issuer', $data)) { |
|
| 81 | + if (!array_key_exists('issuer', $data)) { |
|
| 82 | 82 | throw new RuntimeException('Invalid metadata content, no "issuer" key found'); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | 'code_verifier' => $this->codeVerifier, |
| 142 | 142 | ]; |
| 143 | 143 | |
| 144 | - return array_filter($data, static function ($value) { |
|
| 144 | + return array_filter($data, static function($value) { |
|
| 145 | 145 | return null !== $value; |
| 146 | 146 | }); |
| 147 | 147 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $data = json_decode(base64url_decode(explode('.', $this->idToken)[1] ?? ''), true); |
| 159 | 159 | |
| 160 | - if (! is_array($data)) { |
|
| 160 | + if (!is_array($data)) { |
|
| 161 | 161 | throw new RuntimeException('Unable to decode id_token payload'); |
| 162 | 162 | } |
| 163 | 163 | |