@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | */ |
207 | 207 | protected function configure($config) |
208 | 208 | { |
209 | - if ($this->config->has('captcha.' . $config)) { |
|
210 | - foreach ($this->config->get('captcha.' . $config) as $key => $val) { |
|
209 | + if ($this->config->has('captcha.'.$config)) { |
|
210 | + foreach ($this->config->get('captcha.'.$config) as $key => $val) { |
|
211 | 211 | $this->{$key} = $val; |
212 | 212 | } |
213 | 213 | } |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function create($config = 'default', $api = false) |
224 | 224 | { |
225 | - $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds'); |
|
226 | - $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts'); |
|
225 | + $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds'); |
|
226 | + $this->fonts = $this->files->files(__DIR__.'/../assets/fonts'); |
|
227 | 227 | |
228 | 228 | if (version_compare(app()->version(), '5.5.0', '>=')) { |
229 | - $this->fonts = array_map(function ($file) { |
|
229 | + $this->fonts = array_map(function($file) { |
|
230 | 230 | return $file->getPathName(); |
231 | 231 | }, $this->fonts); |
232 | 232 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | foreach ($text as $key => $char) { |
344 | 344 | $marginLeft = $this->textLeftPadding + ($key * ($this->image->width() - $this->textLeftPadding) / $this->length); |
345 | 345 | |
346 | - $this->image->text($char, $marginLeft, $marginTop, function ($font) { |
|
346 | + $this->image->text($char, $marginLeft, $marginTop, function($font) { |
|
347 | 347 | $font->file($this->font()); |
348 | 348 | $font->size($this->fontSize()); |
349 | 349 | $font->color($this->fontColor()); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | protected function fontColor() |
383 | 383 | { |
384 | - if (!empty($this->fontColors)) { |
|
384 | + if ( ! empty($this->fontColors)) { |
|
385 | 385 | $color = $this->fontColors[rand(0, count($this->fontColors) - 1)]; |
386 | 386 | } else { |
387 | 387 | $color = [rand(0, 255), rand(0, 255), rand(0, 255)]; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | rand(0, $this->image->height()), |
414 | 414 | rand(0, $this->image->width()), |
415 | 415 | rand(0, $this->image->height()), |
416 | - function ($draw) { |
|
416 | + function($draw) { |
|
417 | 417 | $draw->color($this->fontColor()); |
418 | 418 | } |
419 | 419 | ); |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | */ |
431 | 431 | public function check($value) |
432 | 432 | { |
433 | - if (!$this->session->has('captcha')) { |
|
433 | + if ( ! $this->session->has('captcha')) { |
|
434 | 434 | return false; |
435 | 435 | } |
436 | 436 | |
437 | 437 | $key = $this->session->get('captcha.key'); |
438 | 438 | $sensitive = $this->session->get('captcha.sensitive'); |
439 | 439 | |
440 | - if (!$sensitive) { |
|
440 | + if ( ! $sensitive) { |
|
441 | 441 | $value = $this->str->lower($value); |
442 | 442 | } |
443 | 443 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | */ |
470 | 470 | public function src($config = null) |
471 | 471 | { |
472 | - return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8); |
|
472 | + return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
@@ -489,8 +489,8 @@ discard block |
||
489 | 489 | continue; |
490 | 490 | } |
491 | 491 | |
492 | - $attrs_str .= $attr . '="' . $value . '" '; |
|
492 | + $attrs_str .= $attr.'="'.$value.'" '; |
|
493 | 493 | } |
494 | - return new HtmlString('<img src="' . $this->src($config) . '" ' . trim($attrs_str) . '>'); |
|
494 | + return new HtmlString('<img src="'.$this->src($config).'" '.trim($attrs_str).'>'); |
|
495 | 495 | } |
496 | 496 | } |