@@ -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) { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $container[AccountManagerInterface::class] = $factory; |
| 59 | 59 | $container[PassportAccountManagerInterface::class] = $factory; |
| 60 | 60 | |
| 61 | - $container[DatabaseSchemaInterface::class] = function ( |
|
| 61 | + $container[DatabaseSchemaInterface::class] = function( |
|
| 62 | 62 | PsrContainerInterface $container |
| 63 | 63 | ): DatabaseSchemaInterface { |
| 64 | 64 | $settings = $container->get(SettingsProviderInterface::class)->get(C::class); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return new DatabaseSchema($settings[C::KEY_USER_TABLE_NAME], $settings[C::KEY_USER_PRIMARY_KEY_NAME]); |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | - $container[PassportServerInterface::class] = function ( |
|
| 69 | + $container[PassportServerInterface::class] = function( |
|
| 70 | 70 | PsrContainerInterface $container |
| 71 | 71 | ): PassportServerInterface { |
| 72 | 72 | $integration = $container->get(PassportServerIntegrationInterface::class); |
@@ -478,7 +478,7 @@ |
||
| 478 | 478 | * @param string $column |
| 479 | 479 | * @param int $expirationInSeconds |
| 480 | 480 | * @param string $createdAtColumn |
| 481 | - * @param array $columns |
|
| 481 | + * @param string[] $columns |
|
| 482 | 482 | * @param int|null $limit |
| 483 | 483 | * |
| 484 | 484 | * @return array |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function createCode(TokenInterface $code): TokenInterface |
| 48 | 48 | { |
| 49 | 49 | try { |
| 50 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 50 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 51 | 51 | return new DateTimeImmutable(); |
| 52 | 52 | }); |
| 53 | 53 | $schema = $this->getDatabaseSchema(); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $tokenIdentifier = null; |
| 63 | 63 | if (empty($scopeIdentifiers = $code->getScopeIdentifiers()) === false) { |
| 64 | - $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
| 64 | + $this->inTransaction(function() use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
| 65 | 65 | $this->createResource($values); |
| 66 | 66 | $tokenIdentifier = $this->getLastInsertId(); |
| 67 | 67 | $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers); |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | try { |
| 91 | 91 | $query = $this->getConnection()->createQueryBuilder(); |
| 92 | 92 | |
| 93 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 93 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 94 | 94 | return new DateTimeImmutable(); |
| 95 | 95 | }); |
| 96 | 96 | $dbNow = $this->createTypedParameter($query, $now); |
| 97 | 97 | |
| 98 | - $earliestExpired = $this->ignoreException(function () use ($now, $expirationInSeconds) : DateTimeImmutable { |
|
| 98 | + $earliestExpired = $this->ignoreException(function() use ($now, $expirationInSeconds) : DateTimeImmutable { |
|
| 99 | 99 | /** @var DateTimeImmutable $now */ |
| 100 | 100 | return $now->sub(new DateInterval("PT{$expirationInSeconds}S")); |
| 101 | 101 | }); |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | $schema = $this->getDatabaseSchema(); |
| 104 | 104 | $query |
| 105 | 105 | ->update($this->getTableNameForWriting()) |
| 106 | - ->where($schema->getTokensCodeColumn() . '=' . $this->createTypedParameter($query, $token->getCode())) |
|
| 106 | + ->where($schema->getTokensCodeColumn().'='.$this->createTypedParameter($query, $token->getCode())) |
|
| 107 | 107 | ->andWhere( |
| 108 | - $schema->getTokensCodeCreatedAtColumn() . '>' . |
|
| 108 | + $schema->getTokensCodeCreatedAtColumn().'>'. |
|
| 109 | 109 | $this->createTypedParameter($query, $earliestExpired) |
| 110 | 110 | ) |
| 111 | 111 | ->set($schema->getTokensValueColumn(), $this->createTypedParameter($query, $token->getValue())) |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function createToken(TokenInterface $token): TokenInterface |
| 139 | 139 | { |
| 140 | 140 | try { |
| 141 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 141 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 142 | 142 | return new DateTimeImmutable(); |
| 143 | 143 | }); |
| 144 | 144 | $schema = $this->getDatabaseSchema(); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $tokenIdentifier = null; |
| 167 | 167 | if (empty($scopeIdentifiers = $token->getScopeIdentifiers()) === false) { |
| 168 | - $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
| 168 | + $this->inTransaction(function() use ($values, $scopeIdentifiers, &$tokenIdentifier) { |
|
| 169 | 169 | $this->createResource($values); |
| 170 | 170 | $tokenIdentifier = $this->getLastInsertId(); |
| 171 | 171 | $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function bindScopes(int $identifier, iterable $scopes): void |
| 196 | 196 | { |
| 197 | - $getIdentifiers = function (iterable $scopes): iterable { |
|
| 197 | + $getIdentifiers = function(iterable $scopes): iterable { |
|
| 198 | 198 | foreach ($scopes as $scope) { |
| 199 | 199 | /** @var ScopeInterface $scope */ |
| 200 | 200 | assert($scope instanceof ScopeInterface); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $schema = $this->getDatabaseSchema(); |
| 321 | 321 | /** @var TokenInterface[] $tokens */ |
| 322 | 322 | $tokens = $this->readEnabledTokensByColumnWithExpirationCheck( |
| 323 | - (string)$userId, |
|
| 323 | + (string) $userId, |
|
| 324 | 324 | $schema->getTokensUserIdentityColumn(), |
| 325 | 325 | $expirationInSeconds, |
| 326 | 326 | $schema->getTokensValueCreatedAtColumn(), |
@@ -363,13 +363,13 @@ discard block |
||
| 363 | 363 | $query = $this->getConnection()->createQueryBuilder(); |
| 364 | 364 | |
| 365 | 365 | $schema = $this->getDatabaseSchema(); |
| 366 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 366 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 367 | 367 | return new DateTimeImmutable(); |
| 368 | 368 | }); |
| 369 | 369 | $dbNow = $this->createTypedParameter($query, $now); |
| 370 | 370 | $query |
| 371 | 371 | ->update($this->getTableNameForWriting()) |
| 372 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $token->getIdentifier())) |
|
| 372 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $token->getIdentifier())) |
|
| 373 | 373 | ->set($schema->getTokensValueColumn(), $this->createTypedParameter($query, $token->getValue())) |
| 374 | 374 | ->set($schema->getTokensValueCreatedAtColumn(), $dbNow); |
| 375 | 375 | if ($token->getRefreshValue() !== null) { |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $schema = $this->getDatabaseSchema(); |
| 417 | 417 | $query |
| 418 | 418 | ->update($this->getTableNameForWriting()) |
| 419 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier)) |
|
| 419 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier)) |
|
| 420 | 420 | ->set($schema->getTokensIsEnabledColumn(), $this->createTypedParameter($query, false)); |
| 421 | 421 | |
| 422 | 422 | $numberOfUpdated = $query->execute(); |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | $query = $this->addExpirationCondition( |
| 544 | 544 | $query->select($columns) |
| 545 | 545 | ->from($this->getTableNameForReading()) |
| 546 | - ->where($column . '=' . $this->createTypedParameter($query, $identifier)) |
|
| 546 | + ->where($column.'='.$this->createTypedParameter($query, $identifier)) |
|
| 547 | 547 | // SQLite and MySQL work fine with just 1 but PostgreSQL wants it to be a string '1' |
| 548 | 548 | ->andWhere($query->expr()->eq($this->getDatabaseSchema()->getTokensIsEnabledColumn(), "'1'")), |
| 549 | 549 | $expirationInSeconds, |
@@ -565,11 +565,11 @@ discard block |
||
| 565 | 565 | int $expirationInSeconds, |
| 566 | 566 | string $createdAtColumn |
| 567 | 567 | ): QueryBuilder { |
| 568 | - $earliestExpired = $this->ignoreException(function () use ($expirationInSeconds) : DateTimeImmutable { |
|
| 568 | + $earliestExpired = $this->ignoreException(function() use ($expirationInSeconds) : DateTimeImmutable { |
|
| 569 | 569 | return (new DateTimeImmutable())->sub(new DateInterval("PT{$expirationInSeconds}S")); |
| 570 | 570 | }); |
| 571 | 571 | |
| 572 | - $query->andWhere($createdAtColumn . '>' . $this->createTypedParameter($query, $earliestExpired)); |
|
| 572 | + $query->andWhere($createdAtColumn.'>'.$this->createTypedParameter($query, $earliestExpired)); |
|
| 573 | 573 | |
| 574 | 574 | return $query; |
| 575 | 575 | } |
@@ -30,8 +30,8 @@ |
||
| 30 | 30 | use ArrayParserTrait; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * @var string |
|
| 34 | - */ |
|
| 33 | + * @var string |
|
| 34 | + */ |
|
| 35 | 35 | private $modelClass; |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $query = $this->addExpirationCondition( |
| 62 | 62 | $query->select(['*']) |
| 63 | 63 | ->from($schema->getPassportView()) |
| 64 | - ->where($schema->getTokensValueColumn() . '=' . $this->createTypedParameter($query, $tokenValue)) |
|
| 64 | + ->where($schema->getTokensValueColumn().'='.$this->createTypedParameter($query, $tokenValue)) |
|
| 65 | 65 | ->andWhere($query->expr()->eq($this->getDatabaseSchema()->getTokensIsEnabledColumn(), "'1'")), |
| 66 | 66 | $expirationInSeconds, |
| 67 | 67 | $schema->getTokensValueCreatedAtColumn() |
@@ -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); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $statement = $query |
| 43 | 43 | ->select(['*']) |
| 44 | 44 | ->from($this->getTableNameForWriting()) |
| 45 | - ->where($clientIdColumn . '=' . $this->createTypedParameter($query, $clientIdentifier)) |
|
| 45 | + ->where($clientIdColumn.'='.$this->createTypedParameter($query, $clientIdentifier)) |
|
| 46 | 46 | ->execute(); |
| 47 | 47 | |
| 48 | 48 | $statement->setFetchMode(PDO::FETCH_CLASS, $this->getClassName()); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function create(RedirectUriInterface $redirectUri): RedirectUriInterface |
| 64 | 64 | { |
| 65 | 65 | try { |
| 66 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 66 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 67 | 67 | return new DateTimeImmutable(); |
| 68 | 68 | }); |
| 69 | 69 | $schema = $this->getDatabaseSchema(); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | public function update(RedirectUriInterface $redirectUri): void |
| 107 | 107 | { |
| 108 | 108 | try { |
| 109 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 109 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 110 | 110 | return new DateTimeImmutable(); |
| 111 | 111 | }); |
| 112 | 112 | $schema = $this->getDatabaseSchema(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function create(ScopeInterface $scope): ScopeInterface |
| 50 | 50 | { |
| 51 | 51 | try { |
| 52 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 52 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 53 | 53 | return new DateTimeImmutable(); |
| 54 | 54 | }); |
| 55 | 55 | $schema = $this->getDatabaseSchema(); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function update(ScopeInterface $scope): void |
| 92 | 92 | { |
| 93 | 93 | try { |
| 94 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 94 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 95 | 95 | return new DateTimeImmutable(); |
| 96 | 96 | }); |
| 97 | 97 | $schema = $this->getDatabaseSchema(); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function create(ClientInterface $client): ClientInterface |
| 46 | 46 | { |
| 47 | 47 | try { |
| 48 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 48 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 49 | 49 | return new DateTimeImmutable(); |
| 50 | 50 | }); |
| 51 | 51 | $schema = $this->getDatabaseSchema(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if (empty($scopeIdentifiers = $client->getScopeIdentifiers()) === true) { |
| 70 | 70 | $this->createResource($values); |
| 71 | 71 | } else { |
| 72 | - $this->inTransaction(function () use ($identifier, $values, $scopeIdentifiers) { |
|
| 72 | + $this->inTransaction(function() use ($identifier, $values, $scopeIdentifiers) { |
|
| 73 | 73 | $this->createResource($values); |
| 74 | 74 | $this->bindScopeIdentifiers($identifier, $scopeIdentifiers); |
| 75 | 75 | }); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function bindScopes(string $identifier, iterable $scopes): void |
| 92 | 92 | { |
| 93 | - $getIdentifiers = function (iterable $scopes): iterable { |
|
| 93 | + $getIdentifiers = function(iterable $scopes): iterable { |
|
| 94 | 94 | foreach ($scopes as $scope) { |
| 95 | 95 | /** @var ScopeInterface $scope */ |
| 96 | 96 | assert($scope instanceof ScopeInterface); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | public function update(ClientInterface $client): void |
| 210 | 210 | { |
| 211 | 211 | try { |
| 212 | - $now = $this->ignoreException(function (): DateTimeImmutable { |
|
| 212 | + $now = $this->ignoreException(function(): DateTimeImmutable { |
|
| 213 | 213 | return new DateTimeImmutable(); |
| 214 | 214 | }); |
| 215 | 215 | $schema = $this->getDatabaseSchema(); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $query = $this->addExpirationCondition( |
| 62 | 62 | $query->select(['*']) |
| 63 | 63 | ->from($schema->getPassportView()) |
| 64 | - ->where($schema->getTokensValueColumn() . '=' . $this->createTypedParameter($query, $tokenValue)) |
|
| 64 | + ->where($schema->getTokensValueColumn().'='.$this->createTypedParameter($query, $tokenValue)) |
|
| 65 | 65 | ->andWhere($query->expr()->eq($this->getDatabaseSchema()->getTokensIsEnabledColumn(), "'1'")), |
| 66 | 66 | $expirationInSeconds, |
| 67 | 67 | $schema->getTokensValueCreatedAtColumn() |
@@ -154,8 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $curScopes[] = $scopeId; |
| 156 | 156 | } |
| 157 | - $curTokenId === null || empty($curScopes) === true ?: |
|
| 158 | - $tokens[$curTokenId]->setScopeIdentifiers($curScopes); |
|
| 157 | + $curTokenId === null || empty($curScopes) === true ?: $tokens[$curTokenId]->setScopeIdentifiers($curScopes); |
|
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | return $tokens; |
@@ -182,7 +181,7 @@ discard block |
||
| 182 | 181 | $tokenId = $data[$schema->getTokensIdentityColumn()]; |
| 183 | 182 | assert(is_numeric($tokenId)); |
| 184 | 183 | |
| 185 | - $scopes = $this->readScopeIdentifiers((int)$tokenId); |
|
| 184 | + $scopes = $this->readScopeIdentifiers((int) $tokenId); |
|
| 186 | 185 | $data[$schema->getTokensViewScopesColumn()] = $scopes; |
| 187 | 186 | $result = $data; |
| 188 | 187 | } |