@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public static function configureRoutes(GroupInterface $routes): void |
40 | 40 | { |
41 | - $routes->group(static::GROUP_PREFIX, function (GroupInterface $group) { |
|
41 | + $routes->group(static::GROUP_PREFIX, function(GroupInterface $group) { |
|
42 | 42 | $group->get(static::AUTHORIZE_URI, PassportController::AUTHORIZE_HANDLER); |
43 | 43 | $group->post(static::TOKEN_URI, PassportController::TOKEN_HANDLER); |
44 | 44 | }); |
@@ -272,7 +272,7 @@ |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
275 | - * @param string|int $identifier |
|
275 | + * @param string $identifier |
|
276 | 276 | * @param string $hasManyTableName |
277 | 277 | * @param string $hasManyColumn |
278 | 278 | * @param string $hasManyFkName |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $statement = $query |
205 | 205 | ->select($columns) |
206 | 206 | ->from($this->getTableNameForReading()) |
207 | - ->where($column . '=' . $this->createTypedParameter($query, $identifier)) |
|
207 | + ->where($column.'='.$this->createTypedParameter($query, $identifier)) |
|
208 | 208 | ->execute(); |
209 | 209 | |
210 | 210 | $statement->setFetchMode(PDO::FETCH_CLASS, $this->getClassName()); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $query |
234 | 234 | ->update($this->getTableNameForWriting()) |
235 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier)); |
|
235 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier)); |
|
236 | 236 | foreach ($values as $key => $value) { |
237 | 237 | $query->set($key, $this->createTypedParameter($query, $value)); |
238 | 238 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | $query |
263 | 263 | ->delete($this->getTableNameForWriting()) |
264 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier)); |
|
264 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier)); |
|
265 | 265 | |
266 | 266 | $numberOfDeleted = $query->execute(); |
267 | 267 | assert(is_int($numberOfDeleted) === true); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | assert(is_string($primaryKey) === true || is_int($primaryKey) === true); |
295 | 295 | |
296 | 296 | try { |
297 | - $this->inTransaction(function () use ( |
|
297 | + $this->inTransaction(function() use ( |
|
298 | 298 | $intTableName, |
299 | 299 | $intPrimaryKeyName, |
300 | 300 | $intForeignKeyName, |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $query |
344 | 344 | ->select($intForeignKeyName) |
345 | 345 | ->from($intTableName) |
346 | - ->where($intPrimaryKeyName . '=' . $this->createTypedParameter($query, $identifier)); |
|
346 | + ->where($intPrimaryKeyName.'='.$this->createTypedParameter($query, $identifier)); |
|
347 | 347 | |
348 | 348 | $statement = $query->execute(); |
349 | 349 | $statement->setFetchMode(PDO::FETCH_NUM); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | |
377 | 377 | $query |
378 | 378 | ->delete($intTableName) |
379 | - ->where($intPrimaryKeyName . '=' . $this->createTypedParameter($query, $identifier)); |
|
379 | + ->where($intPrimaryKeyName.'='.$this->createTypedParameter($query, $identifier)); |
|
380 | 380 | |
381 | 381 | $numberOfDeleted = $query->execute(); |
382 | 382 | assert(is_int($numberOfDeleted) === true); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $query |
412 | 412 | ->select($hasManyColumn) |
413 | 413 | ->from($hasManyTableName) |
414 | - ->where($hasManyFkName . '=' . $this->createTypedParameter($query, $identifier)); |
|
414 | + ->where($hasManyFkName.'='.$this->createTypedParameter($query, $identifier)); |
|
415 | 415 | |
416 | 416 | $statement = $query->execute(); |
417 | 417 | $statement->setFetchMode(PDO::FETCH_NUM); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @param array $parameters |
33 | 33 | * @param string $realm |
34 | 34 | * |
35 | - * @return ClientInterface|null |
|
35 | + * @return \Limoncello\Passport\Contracts\Entities\ClientInterface|null |
|
36 | 36 | * |
37 | 37 | * @SuppressWarnings(PHPMD.ElseExpression) |
38 | 38 | * @SuppressWarnings(PHPMD.NPathComplexity) |
@@ -57,7 +57,7 @@ |
||
57 | 57 | // try to parse `Authorization` header for client ID and credentials |
58 | 58 | $clientId = null; |
59 | 59 | $clientCredentials = null; |
60 | - $errorHeaders = ['WWW-Authenticate' => 'Basic realm="' . $realm . '"']; |
|
60 | + $errorHeaders = ['WWW-Authenticate' => 'Basic realm="'.$realm.'"']; |
|
61 | 61 | if (empty($headerArray = $authorizationHeader) === false) { |
62 | 62 | $errorCode = OAuthTokenBodyException::ERROR_INVALID_CLIENT; |
63 | 63 | if (empty($authHeader = $headerArray[0]) === true || |
@@ -38,13 +38,13 @@ |
||
38 | 38 | { |
39 | 39 | static::baseConfigureContainer($container); |
40 | 40 | |
41 | - $container[PassportServerIntegrationInterface::class] = function ( |
|
41 | + $container[PassportServerIntegrationInterface::class] = function( |
|
42 | 42 | PsrContainerInterface $container |
43 | 43 | ): PassportServerIntegrationInterface { |
44 | 44 | return new PassportServerIntegration($container); |
45 | 45 | }; |
46 | 46 | |
47 | - $container[TokenRepositoryInterface::class] = function ( |
|
47 | + $container[TokenRepositoryInterface::class] = function( |
|
48 | 48 | PsrContainerInterface $container |
49 | 49 | ): TokenRepositoryInterface { |
50 | 50 | $connection = $container->get(Connection::class); |
@@ -38,13 +38,13 @@ |
||
38 | 38 | { |
39 | 39 | static::baseConfigureContainer($container); |
40 | 40 | |
41 | - $container[PassportServerIntegrationInterface::class] = function ( |
|
41 | + $container[PassportServerIntegrationInterface::class] = function( |
|
42 | 42 | PsrContainerInterface $container |
43 | 43 | ): PassportServerIntegrationInterface { |
44 | 44 | return new PassportServerIntegration($container); |
45 | 45 | }; |
46 | 46 | |
47 | - $container[TokenRepositoryInterface::class] = function ( |
|
47 | + $container[TokenRepositoryInterface::class] = function( |
|
48 | 48 | PsrContainerInterface $container |
49 | 49 | ): TokenRepositoryInterface { |
50 | 50 | $connection = $container->get(Connection::class); |
@@ -63,7 +63,7 @@ |
||
63 | 63 | { |
64 | 64 | if ($this->hasDynamicProperty(static::FIELD_ID) === true) { |
65 | 65 | $this |
66 | - ->setIdentifier((int)$this->{static::FIELD_ID}) |
|
66 | + ->setIdentifier((int) $this->{static::FIELD_ID}) |
|
67 | 67 | ->setClientIdentifier($this->{static::FIELD_ID_CLIENT}) |
68 | 68 | ->setValue($this->{static::FIELD_VALUE}); |
69 | 69 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | assert(is_string($defaultClientId) === true && empty($defaultClientId) === false); |
370 | 370 | |
371 | - $defaultClient = $this->readClientByIdentifier($defaultClientId); |
|
371 | + $defaultClient = $this->readClientByIdentifier($defaultClientId); |
|
372 | 372 | |
373 | 373 | assert($defaultClient !== null); |
374 | 374 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $tokenRepo->updateValues($updatedToken); |
442 | 442 | } else { |
443 | 443 | assert(is_array($scope)); |
444 | - $tokenRepo->inTransaction(function () use ($tokenRepo, $updatedToken, $scope) { |
|
444 | + $tokenRepo->inTransaction(function() use ($tokenRepo, $updatedToken, $scope) { |
|
445 | 445 | $tokenRepo->updateValues($updatedToken); |
446 | 446 | $tokenRepo->unbindScopes($updatedToken->getIdentifier()); |
447 | 447 | $tokenRepo->bindScopeIdentifiers($updatedToken->getIdentifier(), $scope); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | { |
502 | 502 | $this->logDebug('Sending token as JSON response.'); |
503 | 503 | |
504 | - $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
504 | + $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
505 | 505 | null : $token->getScopeList(); |
506 | 506 | |
507 | 507 | // for access token format @link https://tools.ietf.org/html/rfc6749#section-5.1 |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ): ResponseInterface { |
566 | 566 | $this->logDebug('Sending token as redirect response.'); |
567 | 567 | |
568 | - $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
568 | + $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
569 | 569 | null : $token->getScopeList(); |
570 | 570 | |
571 | 571 | // for access token format @link https://tools.ietf.org/html/rfc6749#section-5.1 |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | */ |
722 | 722 | private function filterNulls(array $array): array |
723 | 723 | { |
724 | - return array_filter($array, function ($value) { |
|
724 | + return array_filter($array, function($value) { |
|
725 | 725 | return $value !== null; |
726 | 726 | }); |
727 | 727 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | [ |
141 | 141 | ContainerInterface::class, |
142 | 142 | 'int', |
143 | - function (ReflectionParameter $parameter) { |
|
143 | + function(ReflectionParameter $parameter) { |
|
144 | 144 | return $parameter->allowsNull() === true && $parameter->isArray() === true; |
145 | 145 | }, |
146 | 146 | ] |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $appConfig = $this->getAppConfig(); |
206 | 206 | |
207 | 207 | return [ |
208 | - static::KEY_IS_LOG_ENABLED => (bool)($appConfig[A::KEY_IS_LOG_ENABLED] ?? false), |
|
208 | + static::KEY_IS_LOG_ENABLED => (bool) ($appConfig[A::KEY_IS_LOG_ENABLED] ?? false), |
|
209 | 209 | static::KEY_CODE_EXPIRATION_TIME_IN_SECONDS => 10 * 60, |
210 | 210 | static::KEY_TOKEN_EXPIRATION_TIME_IN_SECONDS => 60 * 60, |
211 | 211 | static::KEY_RENEW_REFRESH_VALUE_ON_TOKEN_REFRESH => true, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | /** @var callable|null $customPropProvider */ |
128 | 128 | $customPropProvider = $this->settings[C::KEY_TOKEN_CUSTOM_PROPERTIES_PROVIDER] ?? null; |
129 | 129 | $wrapper = $customPropProvider !== null ? |
130 | - function (TokenInterface $token) use ($container, $customPropProvider): array { |
|
130 | + function(TokenInterface $token) use ($container, $customPropProvider) : array { |
|
131 | 131 | return call_user_func($customPropProvider, $container, $token); |
132 | 132 | } : null; |
133 | 133 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function generateCodeValue(TokenInterface $token): string |
178 | 178 | { |
179 | - $codeValue = bin2hex(random_bytes(16)) . uniqid(); |
|
179 | + $codeValue = bin2hex(random_bytes(16)).uniqid(); |
|
180 | 180 | |
181 | 181 | assert(is_string($codeValue) === true && empty($codeValue) === false); |
182 | 182 | |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function generateTokenValues(TokenInterface $token): array |
190 | 190 | { |
191 | - $tokenValue = bin2hex(random_bytes(16)) . uniqid(); |
|
191 | + $tokenValue = bin2hex(random_bytes(16)).uniqid(); |
|
192 | 192 | $tokenType = 'bearer'; |
193 | 193 | $tokenExpiresIn = $this->getTokenExpirationPeriod(); |
194 | - $refreshValue = bin2hex(random_bytes(16)) . uniqid(); |
|
194 | + $refreshValue = bin2hex(random_bytes(16)).uniqid(); |
|
195 | 195 | |
196 | 196 | assert(is_string($tokenValue) === true && empty($tokenValue) === false); |
197 | 197 | assert(is_string($tokenType) === true && empty($tokenType) === false); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | self::SCOPE_APPROVAL_IS_SCOPE_MODIFIED => $isScopeModified, |
261 | 261 | self::SCOPE_APPROVAL_SCOPE => $scopeList, |
262 | 262 | self::SCOPE_APPROVAL_STATE => $state, |
263 | - ], function ($value) { |
|
263 | + ], function($value) { |
|
264 | 264 | return $value !== null; |
265 | 265 | }); |
266 | 266 |