@@ -492,7 +492,7 @@ |
||
| 492 | 492 | * @param null $config |
| 493 | 493 | * @param array $attrs HTML attributes supplied to the image tag where key is the attribute |
| 494 | 494 | * and the value is the attribute value |
| 495 | - * @return string |
|
| 495 | + * @return HtmlString |
|
| 496 | 496 | */ |
| 497 | 497 | public function img($config = null, $attrs = []) |
| 498 | 498 | { |
@@ -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','2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ'); |
|
| 201 | + $this->characters = config('captcha.characters', '2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ'); |
|
| 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); |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | $marginTop = $this->image->height() / $this->length; |
| 346 | 346 | |
| 347 | 347 | $i = 0; |
| 348 | - foreach(str_split($this->text) as $char) |
|
| 348 | + foreach (str_split($this->text) as $char) |
|
| 349 | 349 | { |
| 350 | - $marginLeft = $this->textLeftPadding + ($i * ($this->image->width() - $this->textLeftPadding) / $this->length); |
|
| 350 | + $marginLeft = $this->textLeftPadding + ($i * ($this->image->width() - $this->textLeftPadding) / $this->length); |
|
| 351 | 351 | |
| 352 | 352 | $this->image->text($char, $marginLeft, $marginTop, function($font) { |
| 353 | 353 | $font->file($this->font()); |
@@ -418,14 +418,14 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | protected function lines() |
| 420 | 420 | { |
| 421 | - for($i = 0; $i <= $this->lines; $i++) |
|
| 421 | + for ($i = 0; $i <= $this->lines; $i++) |
|
| 422 | 422 | { |
| 423 | 423 | $this->image->line( |
| 424 | 424 | rand(0, $this->image->width()) + $i * rand(0, $this->image->height()), |
| 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 | $draw->color($this->fontColor()); |
| 430 | 430 | } |
| 431 | 431 | ); |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | public function src($config = null) |
| 485 | 485 | { |
| 486 | - return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8); |
|
| 486 | + return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /** |
@@ -497,8 +497,8 @@ discard block |
||
| 497 | 497 | public function img($config = null, $attrs = []) |
| 498 | 498 | { |
| 499 | 499 | $attrs_str = ''; |
| 500 | - foreach($attrs as $attr => $value){ |
|
| 501 | - if ($attr == 'src'){ |
|
| 500 | + foreach ($attrs as $attr => $value) { |
|
| 501 | + if ($attr == 'src') { |
|
| 502 | 502 | //Neglect src attribute |
| 503 | 503 | continue; |
| 504 | 504 | } |