@@ -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 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $this->session = $session; |
| 187 | 187 | $this->hasher = $hasher; |
| 188 | 188 | $this->str = $str; |
| 189 | - $this->characters = config('captcha.characters','2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ'); |
|
| 189 | + $this->characters = config('captcha.characters', '2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ'); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | protected function configure($config) |
| 197 | 197 | { |
| 198 | - if ($this->config->has('captcha.' . $config)) |
|
| 198 | + if ($this->config->has('captcha.'.$config)) |
|
| 199 | 199 | { |
| 200 | - foreach($this->config->get('captcha.' . $config) as $key => $val) |
|
| 200 | + foreach ($this->config->get('captcha.'.$config) as $key => $val) |
|
| 201 | 201 | { |
| 202 | 202 | $this->{$key} = $val; |
| 203 | 203 | } |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function create($config = 'default') |
| 214 | 214 | { |
| 215 | - $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds'); |
|
| 216 | - $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts'); |
|
| 215 | + $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds'); |
|
| 216 | + $this->fonts = $this->files->files(__DIR__.'/../assets/fonts'); |
|
| 217 | 217 | |
| 218 | - if (app()->version() >= 5.5){ |
|
| 218 | + if (app()->version() >= 5.5) { |
|
| 219 | 219 | $this->fonts = array_map(function($file) { |
| 220 | 220 | return $file->getPathName(); |
| 221 | 221 | }, $this->fonts); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $characters = str_split($this->characters); |
| 292 | 292 | |
| 293 | 293 | $bag = ''; |
| 294 | - for($i = 0; $i < $this->length; $i++) |
|
| 294 | + for ($i = 0; $i < $this->length; $i++) |
|
| 295 | 295 | { |
| 296 | 296 | $bag .= $characters[rand(0, count($characters) - 1)]; |
| 297 | 297 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $marginTop = $this->image->height() / $this->length; |
| 313 | 313 | |
| 314 | 314 | $i = 0; |
| 315 | - foreach(str_split($this->text) as $char) |
|
| 315 | + foreach (str_split($this->text) as $char) |
|
| 316 | 316 | { |
| 317 | 317 | $marginLeft = ($i * $this->image->width() / $this->length); |
| 318 | 318 | |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | protected function lines() |
| 387 | 387 | { |
| 388 | - for($i = 0; $i <= $this->lines; $i++) |
|
| 388 | + for ($i = 0; $i <= $this->lines; $i++) |
|
| 389 | 389 | { |
| 390 | 390 | $this->image->line( |
| 391 | 391 | rand(0, $this->image->width()) + $i * rand(0, $this->image->height()), |
| 392 | 392 | rand(0, $this->image->height()), |
| 393 | 393 | rand(0, $this->image->width()), |
| 394 | 394 | rand(0, $this->image->height()), |
| 395 | - function ($draw) { |
|
| 395 | + function($draw) { |
|
| 396 | 396 | $draw->color($this->fontColor()); |
| 397 | 397 | } |
| 398 | 398 | ); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | */ |
| 434 | 434 | public function src($config = null) |
| 435 | 435 | { |
| 436 | - return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8); |
|
| 436 | + return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8); |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | /** |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | */ |
| 445 | 445 | public function img($config = null) |
| 446 | 446 | { |
| 447 | - return '<img src="' . $this->src($config) . '" alt="captcha">'; |
|
| 447 | + return '<img src="'.$this->src($config).'" alt="captcha">'; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | } |