@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function configure($config) |
196 | 196 | { |
197 | - if ($this->config->has('captcha.' . $config)) |
|
197 | + if ($this->config->has('captcha.'.$config)) |
|
198 | 198 | { |
199 | - foreach($this->config->get('captcha.' . $config) as $key => $val) |
|
199 | + foreach ($this->config->get('captcha.'.$config) as $key => $val) |
|
200 | 200 | { |
201 | 201 | $this->{$key} = $val; |
202 | 202 | } |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function create($config = 'default') |
213 | 213 | { |
214 | - $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds'); |
|
215 | - $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts'); |
|
214 | + $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds'); |
|
215 | + $this->fonts = $this->files->files(__DIR__.'/../assets/fonts'); |
|
216 | 216 | $this->fonts = array_values($this->fonts); //reset fonts array index |
217 | 217 | |
218 | 218 | $this->configure($config); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $characters = str_split($this->characters); |
284 | 284 | |
285 | 285 | $bag = ''; |
286 | - for($i = 0; $i < $this->length; $i++) |
|
286 | + for ($i = 0; $i < $this->length; $i++) |
|
287 | 287 | { |
288 | 288 | $bag .= $characters[rand(0, count($characters) - 1)]; |
289 | 289 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $marginTop = $this->image->height() / $this->length; |
305 | 305 | |
306 | 306 | $i = 0; |
307 | - foreach(str_split($this->text) as $char) |
|
307 | + foreach (str_split($this->text) as $char) |
|
308 | 308 | { |
309 | 309 | $marginLeft = ($i * $this->image->width() / $this->length); |
310 | 310 | |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | */ |
378 | 378 | protected function lines() |
379 | 379 | { |
380 | - for($i = 0; $i <= $this->lines; $i++) |
|
380 | + for ($i = 0; $i <= $this->lines; $i++) |
|
381 | 381 | { |
382 | 382 | $this->image->line( |
383 | 383 | rand(0, $this->image->width()) + $i * rand(0, $this->image->height()), |
384 | 384 | rand(0, $this->image->height()), |
385 | 385 | rand(0, $this->image->width()), |
386 | 386 | rand(0, $this->image->height()), |
387 | - function ($draw) { |
|
387 | + function($draw) { |
|
388 | 388 | $draw->color($this->fontColor()); |
389 | 389 | } |
390 | 390 | ); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | */ |
426 | 426 | public function src($config = null) |
427 | 427 | { |
428 | - return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8); |
|
428 | + return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | */ |
437 | 437 | public function img($config = null) |
438 | 438 | { |
439 | - return '<img src="' . $this->src($config) . '" alt="captcha">'; |
|
439 | + return '<img src="'.$this->src($config).'" alt="captcha">'; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | } |
@@ -232,8 +232,7 @@ discard block |
||
232 | 232 | $this->height |
233 | 233 | ); |
234 | 234 | $this->canvas->insert($this->image); |
235 | - } |
|
236 | - else |
|
235 | + } else |
|
237 | 236 | { |
238 | 237 | $this->image = $this->canvas; |
239 | 238 | } |
@@ -351,8 +350,7 @@ discard block |
||
351 | 350 | if ( ! empty($this->fontColors)) |
352 | 351 | { |
353 | 352 | $color = $this->fontColors[rand(0, count($this->fontColors) - 1)]; |
354 | - } |
|
355 | - else |
|
353 | + } else |
|
356 | 354 | { |
357 | 355 | $color = [rand(0, 255), rand(0, 255), rand(0, 255)]; |
358 | 356 | } |