@@ -24,7 +24,7 @@  | 
                                                    ||
| 24 | 24 | |
| 25 | 25 | // HTTP routing  | 
                                                        
| 26 | 26 |          if (strpos($this->app->version(), 'Lumen') !== false) { | 
                                                        
| 27 | -           $this->app->get('captcha[/{config}]', 'Mews\Captcha\LumenCaptchaController@getCaptcha'); | 
                                                        |
| 27 | +            $this->app->get('captcha[/{config}]', 'Mews\Captcha\LumenCaptchaController@getCaptcha'); | 
                                                        |
| 28 | 28 |          } else { | 
                                                        
| 29 | 29 |              if ((double) $this->app->version() >= 5.2) { | 
                                                        
| 30 | 30 |                  $this->app['router']->get('captcha/{config?}', '\Mews\Captcha\CaptchaController@getCaptcha')->middleware('web'); | 
                                                        
@@ -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 | /**  | 
                                                        
@@ -447,14 +447,14 @@ discard block  | 
                                                    ||
| 447 | 447 |      public function img($config = null, $attrs = ['alt' => __('captcha')]) | 
                                                        
| 448 | 448 |      { | 
                                                        
| 449 | 449 | $attrs_str = '';  | 
                                                        
| 450 | -        foreach($attrs as $attr => $value){ | 
                                                        |
| 451 | -            if ($attr == 'src'){ | 
                                                        |
| 450 | +        foreach ($attrs as $attr => $value) { | 
                                                        |
| 451 | +            if ($attr == 'src') { | 
                                                        |
| 452 | 452 | //Neglect src attribute  | 
                                                        
| 453 | 453 | continue;  | 
                                                        
| 454 | 454 | }  | 
                                                        
| 455 | 455 | $attrs_str .= $attr.'="'.$value.'" ';  | 
                                                        
| 456 | 456 | }  | 
                                                        
| 457 | - return '<img src="' . $this->src($config) . '" '. trim($attrs_str).'>';  | 
                                                        |
| 457 | + return '<img src="'.$this->src($config).'" '.trim($attrs_str).'>';  | 
                                                        |
| 458 | 458 | }  | 
                                                        
| 459 | 459 | |
| 460 | 460 | }  |