@@ -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) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ServerRequestInterface $request, |
| 44 | 44 | array $parameters, |
| 45 | 45 | $realm = 'OAuth' |
| 46 | - ): ?ClientInterface { |
|
| 46 | + ): ? ClientInterface { |
|
| 47 | 47 | // A client may use Basic authentication. |
| 48 | 48 | // |
| 49 | 49 | // Or |
@@ -57,7 +57,7 @@ discard block |
||
| 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 || |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | if ($this->hasDynamicProperty(static::FIELD_ID) === true) { |
| 156 | 156 | $this |
| 157 | - ->setIdentifier((int)$this->{static::FIELD_ID}) |
|
| 157 | + ->setIdentifier((int) $this->{static::FIELD_ID}) |
|
| 158 | 158 | ->setClientIdentifier($this->{static::FIELD_ID_CLIENT}) |
| 159 | - ->setUserIdentifier((int)$this->{static::FIELD_ID_USER}) |
|
| 159 | + ->setUserIdentifier((int) $this->{static::FIELD_ID_USER}) |
|
| 160 | 160 | ->setRedirectUriString($this->{static::FIELD_REDIRECT_URI}) |
| 161 | 161 | ->setCode($this->{static::FIELD_CODE}) |
| 162 | 162 | ->setType($this->{static::FIELD_TYPE}) |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | /** |
| 172 | 172 | * @inheritdoc |
| 173 | 173 | */ |
| 174 | - public function getIdentifier(): ?int |
|
| 174 | + public function getIdentifier(): ? int |
|
| 175 | 175 | { |
| 176 | 176 | return $this->identifierField; |
| 177 | 177 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | /** |
| 260 | 260 | * @inheritdoc |
| 261 | 261 | */ |
| 262 | - public function getRedirectUriString(): ?string |
|
| 262 | + public function getRedirectUriString(): ? string |
|
| 263 | 263 | { |
| 264 | 264 | return $this->redirectUriString; |
| 265 | 265 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | /** |
| 268 | 268 | * @inheritdoc |
| 269 | 269 | */ |
| 270 | - public function setRedirectUriString(?string $uri): TokenInterface |
|
| 270 | + public function setRedirectUriString(? string $uri) : TokenInterface |
|
| 271 | 271 | { |
| 272 | 272 | $this->redirectUriString = $uri; |
| 273 | 273 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | /** |
| 342 | 342 | * @inheritdoc |
| 343 | 343 | */ |
| 344 | - public function setCode(?string $code): TokenInterface |
|
| 344 | + public function setCode(? string $code) : TokenInterface |
|
| 345 | 345 | { |
| 346 | 346 | $this->codeField = $code; |
| 347 | 347 | |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | /** |
| 360 | 360 | * @inheritdoc |
| 361 | 361 | */ |
| 362 | - public function setValue(?string $value): TokenInterface |
|
| 362 | + public function setValue(? string $value) : TokenInterface |
|
| 363 | 363 | { |
| 364 | 364 | $this->valueField = $value; |
| 365 | 365 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | /** |
| 370 | 370 | * @inheritdoc |
| 371 | 371 | */ |
| 372 | - public function getType(): ?string |
|
| 372 | + public function getType(): ? string |
|
| 373 | 373 | { |
| 374 | 374 | return $this->typeField; |
| 375 | 375 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | /** |
| 378 | 378 | * @inheritdoc |
| 379 | 379 | */ |
| 380 | - public function setType(?string $type): TokenInterface |
|
| 380 | + public function setType(? string $type) : TokenInterface |
|
| 381 | 381 | { |
| 382 | 382 | $this->typeField = $type; |
| 383 | 383 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | /** |
| 396 | 396 | * @inheritdoc |
| 397 | 397 | */ |
| 398 | - public function setRefreshValue(?string $refreshValue): TokenInterface |
|
| 398 | + public function setRefreshValue(? string $refreshValue) : TokenInterface |
|
| 399 | 399 | { |
| 400 | 400 | $this->refreshValueField = $refreshValue; |
| 401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | /** |
| 406 | 406 | * @inheritdoc |
| 407 | 407 | */ |
| 408 | - public function getCodeCreatedAt(): ?DateTimeInterface |
|
| 408 | + public function getCodeCreatedAt(): ? DateTimeInterface |
|
| 409 | 409 | { |
| 410 | 410 | if ($this->codeCreatedAtField === null && ($codeCreatedAt = $this->{static::FIELD_CODE_CREATED_AT}) !== null) { |
| 411 | 411 | $this->codeCreatedAtField = $this->parseDateTime($codeCreatedAt); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | /** |
| 428 | 428 | * @inheritdoc |
| 429 | 429 | */ |
| 430 | - public function getValueCreatedAt(): ?DateTimeInterface |
|
| 430 | + public function getValueCreatedAt(): ? DateTimeInterface |
|
| 431 | 431 | { |
| 432 | 432 | if ($this->valueCreatedAtField === null && |
| 433 | 433 | ($tokenCreatedAt = $this->{static::FIELD_VALUE_CREATED_AT}) !== null |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | /** |
| 452 | 452 | * @inheritdoc |
| 453 | 453 | */ |
| 454 | - public function getRefreshCreatedAt(): ?DateTimeInterface |
|
| 454 | + public function getRefreshCreatedAt(): ? DateTimeInterface |
|
| 455 | 455 | { |
| 456 | 456 | if ($this->refreshCreatedAtField === null && |
| 457 | 457 | ($tokenCreatedAt = $this->{static::FIELD_VALUE_CREATED_AT}) !== null |
@@ -63,7 +63,7 @@ discard block |
||
| 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 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @inheritdoc |
| 74 | 74 | */ |
| 75 | - public function getIdentifier(): ?int |
|
| 75 | + public function getIdentifier(): ? int |
|
| 76 | 76 | { |
| 77 | 77 | return $this->identifierField; |
| 78 | 78 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | /** |
| 91 | 91 | * @inheritdoc |
| 92 | 92 | */ |
| 93 | - public function getClientIdentifier(): ?string |
|
| 93 | + public function getClientIdentifier(): ? string |
|
| 94 | 94 | { |
| 95 | 95 | return $this->clientIdentifierField; |
| 96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * @inheritdoc |
| 110 | 110 | */ |
| 111 | - public function getValue(): ?string |
|
| 111 | + public function getValue(): ? string |
|
| 112 | 112 | { |
| 113 | 113 | return $this->valueField; |
| 114 | 114 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @inheritdoc |
| 50 | 50 | */ |
| 51 | - public function getCreatedAt(): ?DateTimeInterface |
|
| 51 | + public function getCreatedAt(): ? DateTimeInterface |
|
| 52 | 52 | { |
| 53 | 53 | if ($this->createdAtField === null && |
| 54 | 54 | $this->hasDynamicProperty(static::FIELD_CREATED_AT) === true && |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * @inheritdoc |
| 65 | 65 | */ |
| 66 | - public function getUpdatedAt(): ?DateTimeInterface |
|
| 66 | + public function getUpdatedAt(): ? DateTimeInterface |
|
| 67 | 67 | { |
| 68 | 68 | if ($this->updatedAtField === null && |
| 69 | 69 | $this->hasDynamicProperty(static::FIELD_UPDATED_AT) === true && |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @inheritdoc |
| 57 | 57 | */ |
| 58 | - public function getIdentifier(): ?string |
|
| 58 | + public function getIdentifier(): ? string |
|
| 59 | 59 | { |
| 60 | 60 | return $this->identifierField; |
| 61 | 61 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | /** |
| 74 | 74 | * @inheritdoc |
| 75 | 75 | */ |
| 76 | - public function getDescription(): ?string |
|
| 76 | + public function getDescription(): ? string |
|
| 77 | 77 | { |
| 78 | 78 | return $this->descriptionField; |
| 79 | 79 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | /** |
| 509 | 509 | * @inheritdoc |
| 510 | 510 | */ |
| 511 | - public function getUsersView(): ?string |
|
| 511 | + public function getUsersView(): ? string |
|
| 512 | 512 | { |
| 513 | 513 | return static::VIEW_USERS; |
| 514 | 514 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | /** |
| 517 | 517 | * @inheritdoc |
| 518 | 518 | */ |
| 519 | - public function getUsersTable(): ?string |
|
| 519 | + public function getUsersTable(): ? string |
|
| 520 | 520 | { |
| 521 | 521 | return $this->usersTableName; |
| 522 | 522 | } |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | /** |
| 525 | 525 | * @inheritdoc |
| 526 | 526 | */ |
| 527 | - public function getUsersIdentityColumn(): ?string |
|
| 527 | + public function getUsersIdentityColumn(): ? string |
|
| 528 | 528 | { |
| 529 | 529 | return $this->usersIdColumn; |
| 530 | 530 | } |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | /** |
| 533 | 533 | * @inheritdoc |
| 534 | 534 | */ |
| 535 | - public function getPassportView(): ?string |
|
| 535 | + public function getPassportView(): ? string |
|
| 536 | 536 | { |
| 537 | 537 | return static::VIEW_PASSPORT; |
| 538 | 538 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * @inheritdoc |
| 191 | 191 | */ |
| 192 | - public function getName(): ?string |
|
| 192 | + public function getName(): ? string |
|
| 193 | 193 | { |
| 194 | 194 | return $this->nameField; |
| 195 | 195 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | /** |
| 208 | 208 | * @inheritdoc |
| 209 | 209 | */ |
| 210 | - public function getDescription(): ?string |
|
| 210 | + public function getDescription(): ? string |
|
| 211 | 211 | { |
| 212 | 212 | return $this->descriptionField; |
| 213 | 213 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | /** |
| 226 | 226 | * @inheritdoc |
| 227 | 227 | */ |
| 228 | - public function getCredentials(): ?string |
|
| 228 | + public function getCredentials(): ? string |
|
| 229 | 229 | { |
| 230 | 230 | return $this->credentialsField; |
| 231 | 231 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | ServerRequestInterface $request, |
| 64 | 64 | array $parameters, |
| 65 | 65 | $realm = 'OAuth' |
| 66 | - ): ?ClientInterface; |
|
| 66 | + ): ? ClientInterface; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @var PassportServerIntegrationInterface |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | /** |
| 250 | 250 | * @inheritdoc |
| 251 | 251 | */ |
| 252 | - public function codeReadAuthenticationCode(string $code): ?AuthorizationCodeInterface |
|
| 252 | + public function codeReadAuthenticationCode(string $code): ? AuthorizationCodeInterface |
|
| 253 | 253 | { |
| 254 | 254 | return $this->getIntegration()->getTokenRepository() |
| 255 | 255 | ->readByCode($code, $this->getIntegration()->getCodeExpirationPeriod()); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | assert(is_string($defaultClientId) === true && empty($defaultClientId) === false); |
| 369 | 369 | |
| 370 | - $defaultClient = $this->getIntegration()->getClientRepository()->read($defaultClientId); |
|
| 370 | + $defaultClient = $this->getIntegration()->getClientRepository()->read($defaultClientId); |
|
| 371 | 371 | |
| 372 | 372 | assert($defaultClient !== null); |
| 373 | 373 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | $tokenRepo->updateValues($updatedToken); |
| 441 | 441 | } else { |
| 442 | 442 | assert(is_array($scope)); |
| 443 | - $tokenRepo->inTransaction(function () use ($tokenRepo, $updatedToken, $scope) { |
|
| 443 | + $tokenRepo->inTransaction(function() use ($tokenRepo, $updatedToken, $scope) { |
|
| 444 | 444 | $tokenRepo->updateValues($updatedToken); |
| 445 | 445 | $tokenRepo->unbindScopes($updatedToken->getIdentifier()); |
| 446 | 446 | $tokenRepo->bindScopeIdentifiers($updatedToken->getIdentifier(), $scope); |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | { |
| 493 | 493 | $this->logDebug('Sending token as JSON response.'); |
| 494 | 494 | |
| 495 | - $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
| 495 | + $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
| 496 | 496 | null : $token->getScopeList(); |
| 497 | 497 | |
| 498 | 498 | // for access token format @link https://tools.ietf.org/html/rfc6749#section-5.1 |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | ): ResponseInterface { |
| 557 | 557 | $this->logDebug('Sending token as redirect response.'); |
| 558 | 558 | |
| 559 | - $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
| 559 | + $scopeList = $token->isScopeModified() === false || empty($token->getScopeIdentifiers()) === true ? |
|
| 560 | 560 | null : $token->getScopeList(); |
| 561 | 561 | |
| 562 | 562 | // for access token format @link https://tools.ietf.org/html/rfc6749#section-5.1 |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | */ |
| 700 | 700 | private function filterNulls(array $array): array |
| 701 | 701 | { |
| 702 | - return array_filter($array, function ($value) { |
|
| 702 | + return array_filter($array, function($value) { |
|
| 703 | 703 | return $value !== null; |
| 704 | 704 | }); |
| 705 | 705 | } |
@@ -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 | |