1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2024 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
declare (strict_types=1 );
7
7
17
17
*/
18
18
class CheckCaptchaOnStorefront
19
19
{
20
- /**
21
- * @var HelperCaptcha
22
- */
23
- private $ helper ;
24
-
25
- /**
26
- * Customer session
27
- *
28
- * @var HttpContext
29
- */
30
- private $ httpContext ;
31
-
32
20
/**
33
21
* CheckCaptchaOnStorefront constructor
34
22
*
35
23
* @param HelperCaptcha $helper
36
24
* @param HttpContext $httpContext
37
25
*/
38
26
public function __construct (
39
- HelperCaptcha $ helper ,
40
- HttpContext $ httpContext
41
- ) {
42
- $ this ->helper = $ helper ;
43
- $ this ->httpContext = $ httpContext ;
44
- }
27
+ private readonly HelperCaptcha $ helper ,
28
+ private readonly HttpContext $ httpContext
29
+ ) {}
45
30
46
31
/**
47
- * Remove template when loggin or disable captcha storefront
32
+ * Remove template when login or disable captcha storefront
48
33
*
49
34
* @param AuthenticationPopup $subject
50
35
* @param string $result
@@ -54,8 +39,8 @@ public function __construct(
54
39
*/
55
40
public function afterGetTemplate (
56
41
AuthenticationPopup $ subject ,
57
- $ result
58
- ) {
42
+ string $ result
43
+ ): string {
59
44
if ($ this ->isLoggedIn () || !$ this ->helper ->getConfig ('enable ' )) {
60
45
return '' ;
61
46
}
@@ -68,7 +53,7 @@ public function afterGetTemplate(
68
53
*
69
54
* @return bool
70
55
*/
71
- private function isLoggedIn ()
56
+ private function isLoggedIn (): bool
72
57
{
73
58
return $ this ->httpContext ->getValue (Context::CONTEXT_AUTH );
74
59
}
0 commit comments