@@ -25,7 +25,7 @@ |
||
25 | 25 | /** @var array<string, string> Token cache */ |
26 | 26 | protected $tokens = []; |
27 | 27 | |
28 | - public function init(ArrayAccess &$cookie, int $expire = 3600): void |
|
28 | + public function init(ArrayAccess & $cookie, int $expire = 3600): void |
|
29 | 29 | { |
30 | 30 | if (empty($cookie['csrf_token'])) { |
31 | 31 | $cookie['csrf_token'] = uniqid('csrf', true); |
@@ -71,6 +71,6 @@ |
||
71 | 71 | protected function getHtml(): string |
72 | 72 | { |
73 | 73 | return '<script src="' . NOCAPTCHA_API_SERVER . '"></script> |
74 | - <div class="g-recaptcha" data-sitekey="' . static::$publicKey. '"></div>'; |
|
74 | + <div class="g-recaptcha" data-sitekey="' . static::$publicKey . '"></div>'; |
|
75 | 75 | } |
76 | 76 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | class Text extends AGraphical |
16 | 16 | { |
17 | - public function set(string $alias, ArrayAccess &$session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/FreeMono.ttf'): self |
|
17 | + public function set(string $alias, ArrayAccess & $session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/FreeMono.ttf'): self |
|
18 | 18 | { |
19 | 19 | $this->font = $font; |
20 | 20 | $text = strtoupper($this->generateRandomString(8)); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** @var ArrayAccess */ |
24 | 24 | protected $session = null; |
25 | 25 | |
26 | - protected function fillSession(string $alias, ArrayAccess &$session, string $text): void |
|
26 | + protected function fillSession(string $alias, ArrayAccess & $session, string $text): void |
|
27 | 27 | { |
28 | 28 | $stringNow = $alias . '_now'; |
29 | 29 | $stringLast = $alias . '_last'; |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function generateRandomString(int $stringLength = 16): string |
99 | 99 | { |
100 | - $all = ['1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','g','h','i', |
|
101 | - 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','!','$','%']; |
|
100 | + $all = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', |
|
101 | + 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '!', '$', '%']; |
|
102 | 102 | $string = ''; |
103 | 103 | for ($i = 0; $i < $stringLength; $i++) { |
104 | 104 | $rand = mt_rand(0, count($all) - 1); |
@@ -30,10 +30,10 @@ |
||
30 | 30 | public function __construct(ITimeout $libTimeout = null, string $captchaError = '') |
31 | 31 | { |
32 | 32 | $this->libTimeout = $libTimeout; |
33 | - $this->captchaError = empty($captchaError) ? $this->captchaError : $captchaError ; |
|
33 | + $this->captchaError = empty($captchaError) ? $this->captchaError : $captchaError; |
|
34 | 34 | } |
35 | 35 | |
36 | - public function getCaptcha(int $type, ArrayAccess &$session, string $alias = 'captcha'): ACaptcha |
|
36 | + public function getCaptcha(int $type, ArrayAccess & $session, string $alias = 'captcha'): ACaptcha |
|
37 | 37 | { |
38 | 38 | switch ($type) { |
39 | 39 | case static::TYPE_DISABLED: |
@@ -23,13 +23,13 @@ |
||
23 | 23 | /** @var int How log interval is preset after correct response */ |
24 | 24 | protected $timeout = 0; |
25 | 25 | |
26 | - public function __construct(ArrayAccess &$session, int $timeout = 0) |
|
26 | + public function __construct(ArrayAccess & $session, int $timeout = 0) |
|
27 | 27 | { |
28 | 28 | $this->session = $session; |
29 | 29 | $this->timeout = $timeout; |
30 | 30 | $this->time = ($this->session->offsetExists(static::CAPTCHA_TIME)) |
31 | 31 | ? intval(strval($this->session->offsetGet(static::CAPTCHA_TIME))) |
32 | - : 0 ; |
|
32 | + : 0; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function updateExpire(): void |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | public function getValue() |
26 | 26 | { |
27 | - return $this->getSelected() ? $this->originalValue : '' ; |
|
27 | + return $this->getSelected() ? $this->originalValue : ''; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function getValue() |
22 | 22 | { |
23 | - return $this->getChecked() ? $this->originalValue : '' ; |
|
23 | + return $this->getChecked() ? $this->originalValue : ''; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * @return Controls\Security\Csrf |
374 | 374 | * @codeCoverageIgnore link adapter remote resource |
375 | 375 | */ |
376 | - public function addCsrf(string $alias, ArrayAccess &$cookie, string $errorMessage, $attributes = []) |
|
376 | + public function addCsrf(string $alias, ArrayAccess & $cookie, string $errorMessage, $attributes = []) |
|
377 | 377 | { |
378 | 378 | $csrf = new Controls\Security\Csrf(); |
379 | 379 | $csrf->setHidden($alias, $cookie, $errorMessage)->addAttributes($attributes); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param array<string, string|array<string>>|string $attributes |
390 | 390 | * @return Controls\Security\MultiSend |
391 | 391 | */ |
392 | - public function addMultiSend(string $alias, ArrayAccess &$cookie, string $errorMessage, $attributes = []) |
|
392 | + public function addMultiSend(string $alias, ArrayAccess & $cookie, string $errorMessage, $attributes = []) |
|
393 | 393 | { |
394 | 394 | $csrf = new Controls\Security\MultiSend(); |
395 | 395 | $csrf->setHidden($alias, $cookie, $errorMessage)->addAttributes($attributes); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @param string $errorMessage |
418 | 418 | * @return Controls\Security\Captcha\Text |
419 | 419 | */ |
420 | - public function addCaptchaText(string $alias, ArrayAccess &$session, string $errorMessage = 'Captcha mismatch') |
|
420 | + public function addCaptchaText(string $alias, ArrayAccess & $session, string $errorMessage = 'Captcha mismatch') |
|
421 | 421 | { |
422 | 422 | $captcha = new Controls\Security\Captcha\Text(); |
423 | 423 | $captcha->set($alias, $session, $errorMessage); |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @param string $errorMessage |
433 | 433 | * @return Controls\Security\Captcha\Numerical |
434 | 434 | */ |
435 | - public function addCaptchaMath(string $alias, ArrayAccess &$session, string $errorMessage = 'Captcha mismatch') |
|
435 | + public function addCaptchaMath(string $alias, ArrayAccess & $session, string $errorMessage = 'Captcha mismatch') |
|
436 | 436 | { |
437 | 437 | $captcha = new Controls\Security\Captcha\Numerical(); |
438 | 438 | $captcha->set($alias, $session, $errorMessage); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @param string $errorMessage |
448 | 448 | * @return Controls\Security\Captcha\ColourfulText |
449 | 449 | */ |
450 | - public function addCaptchaColour(string $alias, ArrayAccess &$session, string $errorMessage = 'Captcha mismatch') |
|
450 | + public function addCaptchaColour(string $alias, ArrayAccess & $session, string $errorMessage = 'Captcha mismatch') |
|
451 | 451 | { |
452 | 452 | $captcha = new Controls\Security\Captcha\ColourfulText(); |
453 | 453 | $captcha->set($alias, $session, $errorMessage); |