@@ -63,7 +63,7 @@ |
||
| 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 | }); |
@@ -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 |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $statement = $query |
| 163 | 163 | ->select($columns) |
| 164 | 164 | ->from($this->getTableNameForReading()) |
| 165 | - ->where($column . '=' . $this->createTypedParameter($query, $identifier)) |
|
| 165 | + ->where($column.'='.$this->createTypedParameter($query, $identifier)) |
|
| 166 | 166 | ->execute(); |
| 167 | 167 | |
| 168 | 168 | $statement->setFetchMode(PDO::FETCH_CLASS, $this->getClassName()); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $query |
| 185 | 185 | ->update($this->getTableNameForWriting()) |
| 186 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier)); |
|
| 186 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier)); |
|
| 187 | 187 | foreach ($values as $key => $value) { |
| 188 | 188 | $query->set($key, $this->createTypedParameter($query, $value)); |
| 189 | 189 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | $query |
| 207 | 207 | ->delete($this->getTableNameForWriting()) |
| 208 | - ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier)); |
|
| 208 | + ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier)); |
|
| 209 | 209 | |
| 210 | 210 | $numberOfDeleted = $query->execute(); |
| 211 | 211 | assert(is_int($numberOfDeleted) === true); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $query |
| 263 | 263 | ->select($intForeignKeyName) |
| 264 | 264 | ->from($intTableName) |
| 265 | - ->where($intPrimaryKeyName . '=' . $this->createTypedParameter($query, $identifier)); |
|
| 265 | + ->where($intPrimaryKeyName.'='.$this->createTypedParameter($query, $identifier)); |
|
| 266 | 266 | |
| 267 | 267 | $statement = $query->execute(); |
| 268 | 268 | $statement->setFetchMode(PDO::FETCH_NUM); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $query |
| 292 | 292 | ->select($hasManyColumn) |
| 293 | 293 | ->from($hasManyTableName) |
| 294 | - ->where($hasManyFkName . '=' . $this->createTypedParameter($query, $identifier)); |
|
| 294 | + ->where($hasManyFkName.'='.$this->createTypedParameter($query, $identifier)); |
|
| 295 | 295 | |
| 296 | 296 | $statement = $query->execute(); |
| 297 | 297 | $statement->setFetchMode(PDO::FETCH_NUM); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $query |
| 319 | 319 | ->delete($intTableName) |
| 320 | - ->where($intPrimaryKeyName . '=' . $this->createTypedParameter($query, $identifier)); |
|
| 320 | + ->where($intPrimaryKeyName.'='.$this->createTypedParameter($query, $identifier)); |
|
| 321 | 321 | |
| 322 | 322 | $numberOfDeleted = $query->execute(); |
| 323 | 323 | assert(is_int($numberOfDeleted) === true); |
@@ -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 || |
@@ -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 | |
@@ -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); |
@@ -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()); |
@@ -47,14 +47,14 @@ |
||
| 47 | 47 | /** |
| 48 | 48 | * @inheritdoc |
| 49 | 49 | */ |
| 50 | - public function readPassport(string $tokenValue, int $expirationInSeconds): ?array |
|
| 50 | + public function readPassport(string $tokenValue, int $expirationInSeconds): ? array |
|
| 51 | 51 | { |
| 52 | 52 | $scheme = $this->getDatabaseScheme(); |
| 53 | 53 | $query = $this->getConnection()->createQueryBuilder(); |
| 54 | 54 | $query = $this->addExpirationCondition( |
| 55 | 55 | $query->select(['*']) |
| 56 | 56 | ->from($scheme->getPassportView()) |
| 57 | - ->where($scheme->getTokensValueColumn() . '=' . $this->createTypedParameter($query, $tokenValue)) |
|
| 57 | + ->where($scheme->getTokensValueColumn().'='.$this->createTypedParameter($query, $tokenValue)) |
|
| 58 | 58 | ->andWhere($query->expr()->eq($this->getDatabaseScheme()->getTokensIsEnabledColumn(), '1')), |
| 59 | 59 | $expirationInSeconds, |
| 60 | 60 | $scheme->getTokensValueCreatedAtColumn() |