Skip to content

Commit 5cb4fca

Browse files
TitaKolevatkcreateit
authored andcommitted
OXDEV-10037 Fix static issues
1 parent 9a57d2c commit 5cb4fca

7 files changed

Lines changed: 22 additions & 11 deletions

File tree

src/Authentication/OAuth2/Controller/OAuthController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class OAuthController extends FrontendController
1717
{
1818
public function __construct(
19-
private readonly AuthenticationServiceInterface $authenticationService,
19+
private readonly AuthenticationServiceInterface $authService,
2020
private readonly OAuthRequestInterface $oauthRequest,
2121
private readonly InternalRedirectServiceInterface $redirectService,
2222
private readonly Utils $utils,
@@ -26,7 +26,7 @@ public function __construct(
2626

2727
public function login(): void
2828
{
29-
$authorizationUrl = $this->authenticationService->getAuthorizationUrl(
29+
$authorizationUrl = $this->authService->getAuthorizationUrl(
3030
$this->oauthRequest->getProvider()
3131
);
3232

@@ -40,7 +40,7 @@ public function redirect(): void
4040
return;
4141
}
4242

43-
$this->authenticationService->handleCallback(
43+
$this->authService->handleCallback(
4444
$this->oauthRequest->getProvider(),
4545
$this->oauthRequest->getCode()
4646
);

src/Authentication/TwoFactorAuth/Service/AuthorizeService.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,4 @@ public function getRemainingAttempts(): int
9292

9393
return $verificator->getRemainingAttempts($userId);
9494
}
95-
9695
}

src/Authentication/TwoFactorAuth/Service/Verificator/OTP/Validator/OTPValidator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
{
1919
private const MAX_ATTEMPTS = 5;
2020

21-
public function validateCode(#[\SensitiveParameter] ?string $userCode, #[\SensitiveParameter] string $inputCode): void
22-
{
21+
public function validateCode(
22+
#[\SensitiveParameter] ?string $userCode,
23+
#[\SensitiveParameter] string $inputCode
24+
): void {
2325
if (!$userCode || empty($inputCode)) {
2426
throw new InvalidCodeException();
2527
}

src/Authentication/TwoFactorAuth/Service/Verificator/OTP/Validator/OTPValidatorInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ interface OTPValidatorInterface
1515
/**
1616
* @throws InvalidCodeException
1717
*/
18-
public function validateCode(#[\SensitiveParameter] ?string $userCode, #[\SensitiveParameter] string $inputCode): void;
18+
public function validateCode(
19+
#[\SensitiveParameter] ?string $userCode,
20+
#[\SensitiveParameter] string $inputCode
21+
): void;
1922

2023
public function checkLoginAttempts(int $attempts): void;
2124

src/Authentication/TwoFactorAuth/Transput/JsonResponse.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public function send(array $data): void
2929
{
3030
$this->utils->setHeader('HTTP/1.1 ' . $this->statusCode);
3131
$this->utils->setHeader('Content-Type: application/json');
32-
$this->utils->showMessageAndExit(json_encode($data));
32+
33+
$response = (string) json_encode($data);
34+
$this->utils->showMessageAndExit($response);
3335
}
3436
}

src/Shared/Model/User.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@
2929
*/
3030
class User extends User_parent
3131
{
32-
public function checkValues($sLogin, #[\SensitiveParameter] $sPassword, #[\SensitiveParameter] $sPassword2, $aInvAddress, $aDelAddress): void
33-
{
32+
public function checkValues(
33+
$sLogin,
34+
#[\SensitiveParameter] $sPassword,
35+
#[\SensitiveParameter] $sPassword2,
36+
$aInvAddress,
37+
$aDelAddress
38+
): void {
3439
if ($this->isCaptchaEnabled() && $this->shouldValidateCaptcha()) {
3540
/** @var InputValidator $oInputValidator */
3641
$oInputValidator = Registry::getInputValidator();

tests/Unit/Authentication/OAuth2/Controller/OAuthControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function getSut(
114114
Utils $utils = null,
115115
): OAuthController {
116116
return new OAuthController(
117-
authenticationService: $authenticationService ?? $this->createStub(AuthenticationServiceInterface::class),
117+
authService: $authenticationService ?? $this->createStub(AuthenticationServiceInterface::class),
118118
oauthRequest: $oauthRequest ?? $this->createStub(OAuthRequestInterface::class),
119119
redirectService: $redirectService ?? $this->createStub(InternalRedirectServiceInterface::class),
120120
utils: $utils ?? $this->createStub(Utils::class),

0 commit comments

Comments
 (0)