@@ -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 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $this->session = $session; |
| 199 | 199 | $this->hasher = $hasher; |
| 200 | 200 | $this->str = $str; |
| 201 | - $this->characters = config('captcha.characters',['1','2','3','4','6','7','8','9']); |
|
| 201 | + $this->characters = config('captcha.characters', ['1', '2', '3', '4', '6', '7', '8', '9']); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | protected function configure($config) |
| 209 | 209 | { |
| 210 | - if ($this->config->has('captcha.' . $config)) |
|
| 210 | + if ($this->config->has('captcha.'.$config)) |
|
| 211 | 211 | { |
| 212 | - foreach($this->config->get('captcha.' . $config) as $key => $val) |
|
| 212 | + foreach ($this->config->get('captcha.'.$config) as $key => $val) |
|
| 213 | 213 | { |
| 214 | 214 | $this->{$key} = $val; |
| 215 | 215 | } |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function create($config = 'default', $api = false) |
| 227 | 227 | { |
| 228 | - $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds'); |
|
| 229 | - $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts'); |
|
| 228 | + $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds'); |
|
| 229 | + $this->fonts = $this->files->files(__DIR__.'/../assets/fonts'); |
|
| 230 | 230 | |
| 231 | - if (app()->version() >= 5.5){ |
|
| 231 | + if (app()->version() >= 5.5) { |
|
| 232 | 232 | $this->fonts = array_map(function($file) { |
| 233 | 233 | return $file->getPathName(); |
| 234 | 234 | }, $this->fonts); |
@@ -350,8 +350,8 @@ discard block |
||
| 350 | 350 | $text = str_split($text); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - foreach($text as $key => $char) { |
|
| 354 | - $marginLeft = $this->textLeftPadding + ($key * ($this->image->width() - $this->textLeftPadding) / $this->length); |
|
| 353 | + foreach ($text as $key => $char) { |
|
| 354 | + $marginLeft = $this->textLeftPadding + ($key * ($this->image->width() - $this->textLeftPadding) / $this->length); |
|
| 355 | 355 | |
| 356 | 356 | $this->image->text($char, $marginLeft, $marginTop, function($font) { |
| 357 | 357 | $font->file($this->font()); |
@@ -420,14 +420,14 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | protected function lines() |
| 422 | 422 | { |
| 423 | - for($i = 0; $i <= $this->lines; $i++) |
|
| 423 | + for ($i = 0; $i <= $this->lines; $i++) |
|
| 424 | 424 | { |
| 425 | 425 | $this->image->line( |
| 426 | 426 | rand(0, $this->image->width()) + $i * rand(0, $this->image->height()), |
| 427 | 427 | rand(0, $this->image->height()), |
| 428 | 428 | rand(0, $this->image->width()), |
| 429 | 429 | rand(0, $this->image->height()), |
| 430 | - function ($draw) { |
|
| 430 | + function($draw) { |
|
| 431 | 431 | $draw->color($this->fontColor()); |
| 432 | 432 | } |
| 433 | 433 | ); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | */ |
| 486 | 486 | public function src($config = null) |
| 487 | 487 | { |
| 488 | - return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8); |
|
| 488 | + return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
@@ -499,8 +499,8 @@ discard block |
||
| 499 | 499 | public function img($config = null, $attrs = []) |
| 500 | 500 | { |
| 501 | 501 | $attrs_str = ''; |
| 502 | - foreach($attrs as $attr => $value){ |
|
| 503 | - if ($attr == 'src'){ |
|
| 502 | + foreach ($attrs as $attr => $value) { |
|
| 503 | + if ($attr == 'src') { |
|
| 504 | 504 | //Neglect src attribute |
| 505 | 505 | continue; |
| 506 | 506 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | - 'characters' => ['2','3','4','6','7','8','9','a','b','c','d','e','f','g','h','j','m','n','p','q','r','t','u','x','y','z','A','B','C','D','E','F','G','H','J','M','N','P','Q','R','T','U','X','Y','Z'], |
|
| 5 | + 'characters' => ['2', '3', '4', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'm', 'n', 'p', 'q', 'r', 't', 'u', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'M', 'N', 'P', 'Q', 'R', 'T', 'U', 'X', 'Y', 'Z'], |
|
| 6 | 6 | |
| 7 | 7 | 'default' => [ |
| 8 | 8 | 'length' => 9, |