@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $this->hasher = $hasher; |
205 | 205 | $this->str = $str; |
206 | 206 | $this->characters = config('captcha.characters', ['1', '2', '3', '4', '6', '7', '8', '9']); |
207 | - $this->fontsDirectory = config('captcha.fontsDirectory', __DIR__ . '/../assets/fonts'); |
|
207 | + $this->fontsDirectory = config('captcha.fontsDirectory', __DIR__.'/../assets/fonts'); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | */ |
214 | 214 | protected function configure($config) |
215 | 215 | { |
216 | - if ($this->config->has('captcha.' . $config)) { |
|
217 | - foreach ($this->config->get('captcha.' . $config) as $key => $val) { |
|
216 | + if ($this->config->has('captcha.'.$config)) { |
|
217 | + foreach ($this->config->get('captcha.'.$config) as $key => $val) { |
|
218 | 218 | $this->{$key} = $val; |
219 | 219 | } |
220 | 220 | } |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function create(string $config = 'default', bool $api = false) |
232 | 232 | { |
233 | - $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds'); |
|
233 | + $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds'); |
|
234 | 234 | $this->fonts = $this->files->files($this->fontsDirectory); |
235 | 235 | |
236 | 236 | if (version_compare(app()->version(), '5.5.0', '>=')) { |
237 | - $this->fonts = array_map(function ($file) { |
|
237 | + $this->fonts = array_map(function($file) { |
|
238 | 238 | /* @var File $file */ |
239 | 239 | return $file->getPathName(); |
240 | 240 | }, $this->fonts); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | foreach ($text as $key => $char) { |
355 | 355 | $marginLeft = $this->textLeftPadding + ($key * ($this->image->width() - $this->textLeftPadding) / $this->length); |
356 | 356 | |
357 | - $this->image->text($char, $marginLeft, $marginTop, function ($font) { |
|
357 | + $this->image->text($char, $marginLeft, $marginTop, function($font) { |
|
358 | 358 | /* @var Font $font */ |
359 | 359 | $font->file($this->font()); |
360 | 360 | $font->size($this->fontSize()); |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | */ |
394 | 394 | protected function fontColor(): string |
395 | 395 | { |
396 | - if (!empty($this->fontColors)) { |
|
396 | + if ( ! empty($this->fontColors)) { |
|
397 | 397 | $color = $this->fontColors[rand(0, count($this->fontColors) - 1)]; |
398 | 398 | } else { |
399 | - $color = '#' . str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT); |
|
399 | + $color = '#'.str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | return $color; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | rand(0, $this->image->height()), |
426 | 426 | rand(0, $this->image->width()), |
427 | 427 | rand(0, $this->image->height()), |
428 | - function ($draw) { |
|
428 | + function($draw) { |
|
429 | 429 | /* @var Font $draw */ |
430 | 430 | $draw->color($this->fontColor()); |
431 | 431 | } |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public function check(string $value): bool |
445 | 445 | { |
446 | - if (!$this->session->has('captcha')) { |
|
446 | + if ( ! $this->session->has('captcha')) { |
|
447 | 447 | return false; |
448 | 448 | } |
449 | 449 | |
450 | 450 | $key = $this->session->get('captcha.key'); |
451 | 451 | $sensitive = $this->session->get('captcha.sensitive'); |
452 | 452 | |
453 | - if (!$sensitive) { |
|
453 | + if ( ! $sensitive) { |
|
454 | 454 | $value = $this->str->lower($value); |
455 | 455 | } |
456 | 456 | |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | */ |
484 | 484 | public function src(string $config = 'default'): string |
485 | 485 | { |
486 | - return url('captcha/' . $config) . '?' . $this->str->random(8); |
|
486 | + return url('captcha/'.$config).'?'.$this->str->random(8); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | continue; |
504 | 504 | } |
505 | 505 | |
506 | - $attrs_str .= $attr . '="' . $value . '" '; |
|
506 | + $attrs_str .= $attr.'="'.$value.'" '; |
|
507 | 507 | } |
508 | - return new HtmlString('<img src="' . $this->src($config) . '" ' . trim($attrs_str) . '>'); |
|
508 | + return new HtmlString('<img src="'.$this->src($config).'" '.trim($attrs_str).'>'); |
|
509 | 509 | } |
510 | 510 | } |