@@ -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 || |
@@ -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 |
@@ -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 | } |