@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | if (config()->has('captcha')) |
75 | 75 | { |
76 | - foreach(config('captcha') as $key => $value) |
|
76 | + foreach (config('captcha') as $key => $value) |
|
77 | 77 | { |
78 | 78 | $key = camel_case($key); |
79 | 79 | $this->{$key} = $value; |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | $alphaNumeric = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9)); |
96 | 96 | $text = ''; |
97 | - for ($i=0; $i < $this->length; $i++) { |
|
98 | - $text .= $alphaNumeric[rand(0, count($alphaNumeric) -1)]; |
|
97 | + for ($i = 0; $i < $this->length; $i++) { |
|
98 | + $text .= $alphaNumeric[rand(0, count($alphaNumeric)-1)]; |
|
99 | 99 | } |
100 | 100 | //put captcha code into session |
101 | 101 | session(['captcha' => $text]); |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | protected function hex2rgb() { |
112 | 112 | $hex = str_replace("#", "", $this->fontColor); |
113 | 113 | |
114 | - if(strlen($hex) == 3) { |
|
115 | - $r = hexdec(substr($hex,0,1).substr($hex,0,1)); |
|
116 | - $g = hexdec(substr($hex,1,1).substr($hex,1,1)); |
|
117 | - $b = hexdec(substr($hex,2,1).substr($hex,2,1)); |
|
114 | + if (strlen($hex) == 3) { |
|
115 | + $r = hexdec(substr($hex, 0, 1).substr($hex, 0, 1)); |
|
116 | + $g = hexdec(substr($hex, 1, 1).substr($hex, 1, 1)); |
|
117 | + $b = hexdec(substr($hex, 2, 1).substr($hex, 2, 1)); |
|
118 | 118 | } else { |
119 | - $r = hexdec(substr($hex,0,2)); |
|
120 | - $g = hexdec(substr($hex,2,2)); |
|
121 | - $b = hexdec(substr($hex,4,2)); |
|
119 | + $r = hexdec(substr($hex, 0, 2)); |
|
120 | + $g = hexdec(substr($hex, 2, 2)); |
|
121 | + $b = hexdec(substr($hex, 4, 2)); |
|
122 | 122 | } |
123 | 123 | $rgb = array($r, $g, $b); |
124 | 124 | //return implode(",", $rgb); // returns the rgb values separated by commas |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $this->configure(); |
134 | 134 | |
135 | 135 | imagefilledrectangle($this->img, 0, 0, $this->width, $this->height, $this->backColor); |
136 | - imagettftext ($this->img, $this->size, -5, 10, 40, $this->fontColor, $this->font, $this->randomText()); |
|
136 | + imagettftext($this->img, $this->size, -5, 10, 40, $this->fontColor, $this->font, $this->randomText()); |
|
137 | 137 | header("Content-type: image/png"); |
138 | 138 | imagepng($this->img); |
139 | 139 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function img() |
147 | 147 | { |
148 | - return '<img src="' . $this->src() . '" alt="captcha">'; |
|
148 | + return '<img src="'.$this->src().'" alt="captcha">'; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | |
162 | 162 | $code = session()->has('captcha') ? session()->pull('captcha') : null; |
163 | 163 | |
164 | - if(config('captcha.sensitive')) { |
|
164 | + if (config('captcha.sensitive')) { |
|
165 | 165 | if ($input == $code) { |
166 | - $response = true; |
|
166 | + $response = true; |
|
167 | 167 | } else { |
168 | 168 | $response = false; |
169 | 169 | } |
170 | 170 | } else { |
171 | 171 | if (strtolower($input) == strtolower($code)) { |
172 | - $response = true; |
|
172 | + $response = true; |
|
173 | 173 | } else { |
174 | 174 | $response = false; |
175 | 175 | } |
@@ -184,6 +184,6 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function src() |
186 | 186 | { |
187 | - return url('captcha') . '?' . str_random(8); |
|
187 | + return url('captcha').'?'.str_random(8); |
|
188 | 188 | } |
189 | 189 | } |