@@ -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 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @inheritdoc |
157 | 157 | */ |
158 | - public function verifyAllowedUserScope(int $userIdentity, array $scope = null): ?array |
|
158 | + public function verifyAllowedUserScope(int $userIdentity, array $scope = null): ? array |
|
159 | 159 | { |
160 | 160 | $validator = $this->settings[C::KEY_USER_SCOPE_VALIDATOR]; |
161 | 161 | $nullOrScope = call_user_func($validator, $this->container, $userIdentity, $scope); |
@@ -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 |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | [ |
146 | 146 | ContainerInterface::class, |
147 | 147 | 'int', |
148 | - function (ReflectionParameter $parameter) { |
|
148 | + function(ReflectionParameter $parameter) { |
|
149 | 149 | return $parameter->allowsNull() === true && $parameter->isArray() === true; |
150 | 150 | } |
151 | 151 | ] |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | /** |
176 | 176 | * @return null|callable (static) |
177 | 177 | */ |
178 | - protected function getTokenCustomPropertiesProvider(): ?callable |
|
178 | + protected function getTokenCustomPropertiesProvider(): ? callable |
|
179 | 179 | { |
180 | 180 | return null; |
181 | 181 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | protected static function baseConfigureContainer(LimoncelloContainerInterface $container): void |
44 | 44 | { |
45 | 45 | $accountManager = null; |
46 | - $factory = function ( |
|
46 | + $factory = function( |
|
47 | 47 | PsrContainerInterface $container |
48 | 48 | ) use (&$accountManager): PassportAccountManagerInterface { |
49 | 49 | if ($accountManager === null) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $container[AccountManagerInterface::class] = $factory; |
56 | 56 | $container[PassportAccountManagerInterface::class] = $factory; |
57 | 57 | |
58 | - $container[DatabaseSchemeInterface::class] = function ( |
|
58 | + $container[DatabaseSchemeInterface::class] = function( |
|
59 | 59 | PsrContainerInterface $container |
60 | 60 | ): DatabaseSchemeInterface { |
61 | 61 | $settings = $container->get(SettingsProviderInterface::class)->get(C::class); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return new DatabaseScheme($settings[C::KEY_USER_TABLE_NAME], $settings[C::KEY_USER_PRIMARY_KEY_NAME]); |
64 | 64 | }; |
65 | 65 | |
66 | - $container[PassportServerInterface::class] = function ( |
|
66 | + $container[PassportServerInterface::class] = function( |
|
67 | 67 | PsrContainerInterface $container |
68 | 68 | ): PassportServerInterface { |
69 | 69 | $integration = $container->get(PassportServerIntegrationInterface::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); |
@@ -40,13 +40,13 @@ |
||
40 | 40 | { |
41 | 41 | static::baseConfigureContainer($container); |
42 | 42 | |
43 | - $container[PassportServerIntegrationInterface::class] = function ( |
|
43 | + $container[PassportServerIntegrationInterface::class] = function( |
|
44 | 44 | PsrContainerInterface $container |
45 | 45 | ): PassportServerIntegrationInterface { |
46 | 46 | return new PassportServerIntegration($container); |
47 | 47 | }; |
48 | 48 | |
49 | - $container[TokenRepositoryInterface::class] = function ( |
|
49 | + $container[TokenRepositoryInterface::class] = function( |
|
50 | 50 | PsrContainerInterface $container |
51 | 51 | ): TokenRepositoryInterface { |
52 | 52 | $connection = $container->get(Connection::class); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $tokenIdentifier = null; |
52 | 52 | if (empty($scopeIdentifiers = $code->getScopeIdentifiers()) === false) { |
53 | - $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
53 | + $this->inTransaction(function() use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
54 | 54 | $tokenIdentifier = $this->createResource($values); |
55 | 55 | $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers); |
56 | 56 | }); |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $scheme = $this->getDatabaseScheme(); |
77 | 77 | $query |
78 | 78 | ->update($this->getTableNameForWriting()) |
79 | - ->where($scheme->getTokensCodeColumn() . '=' . $this->createTypedParameter($query, $token->getCode())) |
|
79 | + ->where($scheme->getTokensCodeColumn().'='.$this->createTypedParameter($query, $token->getCode())) |
|
80 | 80 | ->andWhere( |
81 | - $scheme->getTokensCodeCreatedAtColumn() . '>' . $this->createTypedParameter($query, $earliestExpired) |
|
81 | + $scheme->getTokensCodeCreatedAtColumn().'>'.$this->createTypedParameter($query, $earliestExpired) |
|
82 | 82 | ) |
83 | 83 | ->set($scheme->getTokensValueColumn(), $this->createTypedParameter($query, $token->getValue())) |
84 | 84 | ->set($scheme->getTokensTypeColumn(), $this->createTypedParameter($query, $token->getType())) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $tokenIdentifier = null; |
128 | 128 | if (empty($scopeIdentifiers = $token->getScopeIdentifiers()) === false) { |
129 | - $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
129 | + $this->inTransaction(function() use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
130 | 130 | $tokenIdentifier = $this->createResource($values); |
131 | 131 | $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers); |
132 | 132 | }); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /** |
191 | 191 | * @inheritdoc |
192 | 192 | */ |
193 | - public function read(int $identifier): ?TokenInterface |
|
193 | + public function read(int $identifier): ? TokenInterface |
|
194 | 194 | { |
195 | 195 | return $this->readResource($identifier); |
196 | 196 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | /** |
199 | 199 | * @inheritdoc |
200 | 200 | */ |
201 | - public function readByCode(string $code, int $expirationInSeconds): ?TokenInterface |
|
201 | + public function readByCode(string $code, int $expirationInSeconds): ? TokenInterface |
|
202 | 202 | { |
203 | 203 | $scheme = $this->getDatabaseScheme(); |
204 | 204 | return $this->readEnabledTokenByColumnWithExpirationCheck( |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | /** |
213 | 213 | * @inheritdoc |
214 | 214 | */ |
215 | - public function readByValue(string $tokenValue, int $expirationInSeconds): ?TokenInterface |
|
215 | + public function readByValue(string $tokenValue, int $expirationInSeconds): ? TokenInterface |
|
216 | 216 | { |
217 | 217 | $scheme = $this->getDatabaseScheme(); |
218 | 218 | return $this->readEnabledTokenByColumnWithExpirationCheck( |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | /** |
227 | 227 | * @inheritdoc |
228 | 228 | */ |
229 | - public function readByRefresh(string $refreshValue, int $expirationInSeconds): ?TokenInterface |
|
229 | + public function readByRefresh(string $refreshValue, int $expirationInSeconds): ? TokenInterface |
|
230 | 230 | { |
231 | 231 | $scheme = $this->getDatabaseScheme(); |
232 | 232 | return $this->readEnabledTokenByColumnWithExpirationCheck( |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $dbNow = $this->createTypedParameter($query, $now); |
283 | 283 | $query |
284 | 284 | ->update($this->getTableNameForWriting()) |
285 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $token->getIdentifier())) |
|
285 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $token->getIdentifier())) |
|
286 | 286 | ->set($scheme->getTokensValueColumn(), $this->createTypedParameter($query, $token->getValue())) |
287 | 287 | ->set($scheme->getTokensValueCreatedAtColumn(), $dbNow); |
288 | 288 | if ($token->getRefreshValue() !== null) { |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $scheme = $this->getDatabaseScheme(); |
320 | 320 | $query |
321 | 321 | ->update($this->getTableNameForWriting()) |
322 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier)) |
|
322 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier)) |
|
323 | 323 | ->set($scheme->getTokensIsEnabledColumn(), $this->createTypedParameter($query, false)); |
324 | 324 | |
325 | 325 | $numberOfUpdated = $query->execute(); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | int $expirationInSeconds, |
358 | 358 | string $createdAtColumn, |
359 | 359 | array $columns = ['*'] |
360 | - ): ?TokenInterface { |
|
360 | + ): ? TokenInterface { |
|
361 | 361 | $query = $this->createEnabledTokenByColumnWithExpirationCheckQuery( |
362 | 362 | $identifier, |
363 | 363 | $column, |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $query = $this->addExpirationCondition( |
433 | 433 | $query->select($columns) |
434 | 434 | ->from($this->getTableNameForReading()) |
435 | - ->where($column . '=' . $this->createTypedParameter($query, $identifier)) |
|
435 | + ->where($column.'='.$this->createTypedParameter($query, $identifier)) |
|
436 | 436 | ->andWhere($query->expr()->eq($this->getDatabaseScheme()->getTokensIsEnabledColumn(), '1')), |
437 | 437 | $expirationInSeconds, |
438 | 438 | $createdAtColumn |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | string $createdAtColumn |
455 | 455 | ): QueryBuilder { |
456 | 456 | $earliestExpired = (new DateTimeImmutable())->sub(new DateInterval("PT{$expirationInSeconds}S")); |
457 | - $query->andWhere($createdAtColumn . '>' . $this->createTypedParameter($query, $earliestExpired)); |
|
457 | + $query->andWhere($createdAtColumn.'>'.$this->createTypedParameter($query, $earliestExpired)); |
|
458 | 458 | |
459 | 459 | return $query; |
460 | 460 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if (empty($scopeIdentifiers = $client->getScopeIdentifiers()) === true) { |
64 | 64 | $this->createResource($values); |
65 | 65 | } else { |
66 | - $this->inTransaction(function () use ($identifier, $values, $scopeIdentifiers) { |
|
66 | + $this->inTransaction(function() use ($identifier, $values, $scopeIdentifiers) { |
|
67 | 67 | $this->createResource($values); |
68 | 68 | $this->bindScopeIdentifiers($identifier, $scopeIdentifiers); |
69 | 69 | }); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * @inheritdoc |
126 | 126 | */ |
127 | - public function read(string $identifier): ?ClientInterface |
|
127 | + public function read(string $identifier): ? ClientInterface |
|
128 | 128 | { |
129 | 129 | return $this->readResource($identifier); |
130 | 130 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $statement = $query |
38 | 38 | ->select(['*']) |
39 | 39 | ->from($this->getTableNameForWriting()) |
40 | - ->where($clientIdColumn . '=' . $this->createTypedParameter($query, $clientIdentifier)) |
|
40 | + ->where($clientIdColumn.'='.$this->createTypedParameter($query, $clientIdentifier)) |
|
41 | 41 | ->execute(); |
42 | 42 | |
43 | 43 | $statement->setFetchMode(PDO::FETCH_CLASS, $this->getClassName()); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @inheritdoc |
55 | 55 | */ |
56 | - public function getAccount(): ?AccountInterface |
|
56 | + public function getAccount(): ? AccountInterface |
|
57 | 57 | { |
58 | 58 | return $this->getPassport(); |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * @inheritdoc |
63 | 63 | */ |
64 | - public function getPassport(): ?PassportAccountInterface |
|
64 | + public function getPassport(): ? PassportAccountInterface |
|
65 | 65 | { |
66 | 66 | return $this->account; |
67 | 67 | } |