@@ -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'): AGraphical |
|
17 | + public function set(string $alias, ArrayAccess & $session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/FreeMono.ttf'): AGraphical |
|
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'): AGraphical |
|
18 | + public function set(string $alias, ArrayAccess & $session, string $errorMessage, string $font = '/usr/share/fonts/truetype/freefont/freesans.ttf'): AGraphical |
|
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 |
@@ -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): self |
|
23 | + public function setHidden(string $alias, ArrayAccess & $cookie, string $errorMessage): self |
|
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 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | return new Csrf\JWT(); |
38 | 38 | } |
39 | 39 | |
40 | - public function setHidden(string $alias, ArrayAccess &$cookie, string $errorMessage): self |
|
40 | + public function setHidden(string $alias, ArrayAccess & $cookie, string $errorMessage): self |
|
41 | 41 | { |
42 | 42 | $this->csrf->init($cookie); |
43 | 43 | $this->setEntry($alias); |