Completed
Push — master ( 77ee35...209706 )
by MeWebStudio - Muharrem
11s queued 10s
created
src/Captcha.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         $this->hasher = $hasher;
204 204
         $this->str = $str;
205 205
         $this->characters = config('captcha.characters', ['1', '2', '3', '4', '6', '7', '8', '9']);
206
-        $this->fontsDirectory = config('captcha.fontsDirectory', __DIR__ . '/../assets/fonts');
206
+        $this->fontsDirectory = config('captcha.fontsDirectory', __DIR__.'/../assets/fonts');
207 207
     }
208 208
 
209 209
     /**
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
      */
213 213
     protected function configure($config)
214 214
     {
215
-        if ($this->config->has('captcha.' . $config)) {
216
-            foreach ($this->config->get('captcha.' . $config) as $key => $val) {
215
+        if ($this->config->has('captcha.'.$config)) {
216
+            foreach ($this->config->get('captcha.'.$config) as $key => $val) {
217 217
                 $this->{$key} = $val;
218 218
             }
219 219
         }
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function create($config = 'default', $api = false)
230 230
     {
231
-        $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds');
231
+        $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds');
232 232
         $this->fonts = $this->files->files($this->fontsDirectory);
233 233
 
234 234
         if (app()->version() >= 5.5) {
235
-            $this->fonts = array_map(function ($file) {
235
+            $this->fonts = array_map(function($file) {
236 236
                 return $file->getPathName();
237 237
             }, $this->fonts);
238 238
         }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         foreach ($text as $key => $char) {
350 350
             $marginLeft = $this->textLeftPadding + ($key * ($this->image->width() - $this->textLeftPadding) / $this->length);
351 351
 
352
-            $this->image->text($char, $marginLeft, $marginTop, function ($font) {
352
+            $this->image->text($char, $marginLeft, $marginTop, function($font) {
353 353
                 $font->file($this->font());
354 354
                 $font->size($this->fontSize());
355 355
                 $font->color($this->fontColor());
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      */
388 388
     protected function fontColor()
389 389
     {
390
-        if (!empty($this->fontColors)) {
390
+        if ( ! empty($this->fontColors)) {
391 391
             $color = $this->fontColors[rand(0, count($this->fontColors) - 1)];
392 392
         } else {
393 393
             $color = [rand(0, 255), rand(0, 255), rand(0, 255)];
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
                 rand(0, $this->image->height()),
420 420
                 rand(0, $this->image->width()),
421 421
                 rand(0, $this->image->height()),
422
-                function ($draw) {
422
+                function($draw) {
423 423
                     $draw->color($this->fontColor());
424 424
                 }
425 425
             );
@@ -436,14 +436,14 @@  discard block
 block discarded – undo
436 436
      */
437 437
     public function check($value)
438 438
     {
439
-        if (!$this->session->has('captcha')) {
439
+        if ( ! $this->session->has('captcha')) {
440 440
             return false;
441 441
         }
442 442
 
443 443
         $key = $this->session->get('captcha.key');
444 444
         $sensitive = $this->session->get('captcha.sensitive');
445 445
 
446
-        if (!$sensitive) {
446
+        if ( ! $sensitive) {
447 447
             $value = $this->str->lower($value);
448 448
         }
449 449
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
      */
476 476
     public function src($config = null)
477 477
     {
478
-        return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8);
478
+        return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8);
479 479
     }
480 480
 
481 481
     /**
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
                 continue;
496 496
             }
497 497
 
498
-            $attrs_str .= $attr . '="' . $value . '" ';
498
+            $attrs_str .= $attr.'="'.$value.'" ';
499 499
         }
500
-        return new HtmlString('<img src="' . $this->src($config) . '" ' . trim($attrs_str) . '>');
500
+        return new HtmlString('<img src="'.$this->src($config).'" '.trim($attrs_str).'>');
501 501
     }
502 502
 }
Please login to merge, or discard this patch.