@@ -19,7 +19,7 @@ |
||
19 | 19 | if (empty($title) && !empty($alias)) { |
20 | 20 | $title = $alias; |
21 | 21 | } |
22 | - $title = empty($title) ? strval($this->originalValue) : $title ; |
|
22 | + $title = empty($title) ? strval($this->originalValue) : $title; |
|
23 | 23 | if (empty($alias)) { |
24 | 24 | $alias = $title; |
25 | 25 | } |
@@ -164,7 +164,7 @@ |
||
164 | 164 | |
165 | 165 | protected function escaped(string $content): string |
166 | 166 | { |
167 | - return static::$escapeOutput ? htmlspecialchars($content, ENT_QUOTES | ENT_HTML5, 'UTF-8', false) : $content ; |
|
167 | + return static::$escapeOutput ? htmlspecialchars($content, ENT_QUOTES | ENT_HTML5, 'UTF-8', false) : $content; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | public function count(): int |
@@ -37,7 +37,7 @@ |
||
37 | 37 | return new Csrf\JWT(); |
38 | 38 | } |
39 | 39 | |
40 | - public function setHidden(string $alias, ArrayAccess &$cookie, string $errorMessage): parent |
|
40 | + public function setHidden(string $alias, ArrayAccess & $cookie, string $errorMessage): parent |
|
41 | 41 | { |
42 | 42 | $this->csrf->init($cookie); |
43 | 43 | $this->setEntry($alias); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** @var int */ |
20 | 20 | protected $expire = 3600; |
21 | 21 | |
22 | - public function init(ArrayAccess &$session, int $expire = 3600): void |
|
22 | + public function init(ArrayAccess & $session, int $expire = 3600): void |
|
23 | 23 | { |
24 | 24 | $this->session = $session; |
25 | 25 | $this->expire = $expire; |
@@ -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); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** @var ArrayAccess */ |
21 | 21 | protected $cookie = null; |
22 | 22 | |
23 | - public function setHidden(string $alias, ArrayAccess &$cookie, string $errorMessage): parent |
|
23 | + public function setHidden(string $alias, ArrayAccess & $cookie, string $errorMessage): parent |
|
24 | 24 | { |
25 | 25 | $this->cookie = $cookie; |
26 | 26 | $this->setEntry($alias); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $hashStack = $this->cookie->offsetExists($this->getKey() . 'SubmitCheck') |
66 | 66 | ? (array) json_decode($this->cookie->offsetGet($this->getKey() . 'SubmitCheck'), true) |
67 | - : null ; |
|
67 | + : null; |
|
68 | 68 | if (is_null($hashStack)) { |
69 | 69 | $hashStack = []; |
70 | 70 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class Numerical extends AGraphical |
16 | 16 | { |
17 | - public function set(string $alias, ArrayAccess &$session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/FreeMono.ttf'): parent |
|
17 | + public function set(string $alias, ArrayAccess & $session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/FreeMono.ttf'): parent |
|
18 | 18 | { |
19 | 19 | $this->font = $font; |
20 | 20 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | |
52 | 52 | public function renderInput($attributes = null): string |
53 | 53 | { |
54 | - return parent::renderLabel() . ' '. parent::renderInput($attributes); |
|
54 | + return parent::renderLabel() . ' ' . parent::renderInput($attributes); |
|
55 | 55 | } |
56 | 56 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class ColourfulText extends AGraphical |
17 | 17 | { |
18 | - public function set(string $alias, ArrayAccess &$session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/freesans.ttf'): parent |
|
18 | + public function set(string $alias, ArrayAccess & $session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/freesans.ttf'): parent |
|
19 | 19 | { |
20 | 20 | $this->font = $font; |
21 | 21 | $text = $this->generateRandomString(6); |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | # height of the ellipse are random numbers between 0 and 3, for obtaining ellipses with dot aspect. |
76 | 76 | # generate random dots |
77 | 77 | for ($i = 0; $i < ($width * $height); $i++) { |
78 | - imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0,3), mt_rand(0,3), $dots_color); |
|
78 | + imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, 3), mt_rand(0, 3), $dots_color); |
|
79 | 79 | } |
80 | 80 | # To generate random lines using the imageline PHP function, randomly generate the lengths and the |
81 | 81 | # coordinates of the lines as in the below code: |
82 | 82 | # generate random lines |
83 | - for ($i=0; $i < ($width + $height) / 3; $i++) { |
|
83 | + for ($i = 0; $i < ($width + $height) / 3; $i++) { |
|
84 | 84 | imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $line_color); |
85 | 85 | } |
86 | 86 | # To generate random rectangles using the imagerectangle PHP function, randomly generate the sizes |
87 | 87 | # of the rectangles as in the below code: |
88 | 88 | # generate random rectangles |
89 | - for ($i=0; $i < ($width + $height) / 3; $i++) { |
|
89 | + for ($i = 0; $i < ($width + $height) / 3; $i++) { |
|
90 | 90 | imagerectangle($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $rect_color); |
91 | 91 | } |
92 | 92 | # Create a bounding box of text using TrueType fonts. To do that, you can use the imagettfbbox PHP function: |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | # The most important step is writing the generated text on top of the generated image using the TrueType |
102 | 102 | # font. For this, you need the imagettftext PHP function. |
103 | - $urcX = ($width - $tb[4])/2; # tb[4] = upper right corner, X position |
|
104 | - $urcY = ($height - $tb[5])/2; # tb[5] = upper right corner, Y position |
|
103 | + $urcX = ($width - $tb[4]) / 2; # tb[4] = upper right corner, X position |
|
104 | + $urcY = ($height - $tb[5]) / 2; # tb[5] = upper right corner, Y position |
|
105 | 105 | # write the given text into the image using TrueType font |
106 | 106 | imagettftext($image, mt_rand(intval($height * 0.30), intval($height * 0.40)), 0, $urcX, $urcY, $captcha_color, $this->font, $text); |
107 | 107 | # For a nice design, you can go further and apply image filters. For example, you can apply |
@@ -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 | } |