Completed
Push — master ( d3c863...44ed8d )
by MeWebStudio - Muharrem
01:41
created
src/Captcha.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $this->session = $session;
198 198
         $this->hasher = $hasher;
199 199
         $this->str = $str;
200
-        $this->characters = config('captcha.characters','2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ');
200
+        $this->characters = config('captcha.characters', '2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ');
201 201
     }
202 202
 
203 203
     /**
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
      */
207 207
     protected function configure($config)
208 208
     {
209
-        if ($this->config->has('captcha.' . $config))
209
+        if ($this->config->has('captcha.'.$config))
210 210
         {
211
-            foreach($this->config->get('captcha.' . $config) as $key => $val)
211
+            foreach ($this->config->get('captcha.'.$config) as $key => $val)
212 212
             {
213 213
                 $this->{$key} = $val;
214 214
             }
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function create($config = 'default', $api = false)
226 226
     {
227
-        $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds');
228
-        $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts');
227
+        $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds');
228
+        $this->fonts = $this->files->files(__DIR__.'/../assets/fonts');
229 229
 
230
-        if (app()->version() >= 5.5){
230
+        if (app()->version() >= 5.5) {
231 231
             $this->fonts = array_map(function($file) {
232 232
                 return $file->getPathName();
233 233
             }, $this->fonts);
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
         $marginTop = $this->image->height() / $this->length;
347 347
 
348 348
         $i = 0;
349
-        foreach(str_split($this->text) as $char)
349
+        foreach (str_split($this->text) as $char)
350 350
         {
351
-            $marginLeft = $this->textLeftPadding +  ($i * ($this->image->width() - $this->textLeftPadding) / $this->length);
351
+            $marginLeft = $this->textLeftPadding + ($i * ($this->image->width() - $this->textLeftPadding) / $this->length);
352 352
 
353 353
             $this->image->text($char, $marginLeft, $marginTop, function($font) {
354 354
                 $font->file($this->font());
@@ -419,14 +419,14 @@  discard block
 block discarded – undo
419 419
      */
420 420
     protected function lines()
421 421
     {
422
-        for($i = 0; $i <= $this->lines; $i++)
422
+        for ($i = 0; $i <= $this->lines; $i++)
423 423
         {
424 424
             $this->image->line(
425 425
                 rand(0, $this->image->width()) + $i * rand(0, $this->image->height()),
426 426
                 rand(0, $this->image->height()),
427 427
                 rand(0, $this->image->width()),
428 428
                 rand(0, $this->image->height()),
429
-                function ($draw) {
429
+                function($draw) {
430 430
                     $draw->color($this->fontColor());
431 431
                 }
432 432
             );
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      */
480 480
     public function src($config = null)
481 481
     {
482
-        return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8);
482
+        return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8);
483 483
     }
484 484
 
485 485
     /**
@@ -493,14 +493,14 @@  discard block
 block discarded – undo
493 493
     public function img($config = null, $attrs = [])
494 494
     {
495 495
         $attrs_str = '';
496
-        foreach($attrs as $attr => $value){
497
-            if ($attr == 'src'){
496
+        foreach ($attrs as $attr => $value) {
497
+            if ($attr == 'src') {
498 498
                 //Neglect src attribute
499 499
                 continue;
500 500
             }
501 501
             $attrs_str .= $attr.'="'.$value.'" ';
502 502
         }
503
-        return '<img src="' . $this->src($config) . '" '. trim($attrs_str).'>';
503
+        return '<img src="'.$this->src($config).'" '.trim($attrs_str).'>';
504 504
     }
505 505
 
506 506
 }
Please login to merge, or discard this patch.