Completed
Push — master ( 8a1de3...77ee35 )
by MeWebStudio - Muharrem
01:39
created
src/Captcha.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
      */
207 207
     protected function configure($config)
208 208
     {
209
-        if ($this->config->has('captcha.' . $config)) {
210
-            foreach ($this->config->get('captcha.' . $config) as $key => $val) {
209
+        if ($this->config->has('captcha.'.$config)) {
210
+            foreach ($this->config->get('captcha.'.$config) as $key => $val) {
211 211
                 $this->{$key} = $val;
212 212
             }
213 213
         }
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function create($config = 'default', $api = false)
224 224
     {
225
-        $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds');
226
-        $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts');
225
+        $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds');
226
+        $this->fonts = $this->files->files(__DIR__.'/../assets/fonts');
227 227
 
228 228
         if (app()->version() >= 5.5) {
229
-            $this->fonts = array_map(function ($file) {
229
+            $this->fonts = array_map(function($file) {
230 230
                 return $file->getPathName();
231 231
             }, $this->fonts);
232 232
         }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         foreach ($text as $key => $char) {
344 344
             $marginLeft = $this->textLeftPadding + ($key * ($this->image->width() - $this->textLeftPadding) / $this->length);
345 345
 
346
-            $this->image->text($char, $marginLeft, $marginTop, function ($font) {
346
+            $this->image->text($char, $marginLeft, $marginTop, function($font) {
347 347
                 $font->file($this->font());
348 348
                 $font->size($this->fontSize());
349 349
                 $font->color($this->fontColor());
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
      */
382 382
     protected function fontColor()
383 383
     {
384
-        if (!empty($this->fontColors)) {
384
+        if ( ! empty($this->fontColors)) {
385 385
             $color = $this->fontColors[rand(0, count($this->fontColors) - 1)];
386 386
         } else {
387 387
             $color = [rand(0, 255), rand(0, 255), rand(0, 255)];
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                 rand(0, $this->image->height()),
414 414
                 rand(0, $this->image->width()),
415 415
                 rand(0, $this->image->height()),
416
-                function ($draw) {
416
+                function($draw) {
417 417
                     $draw->color($this->fontColor());
418 418
                 }
419 419
             );
@@ -430,14 +430,14 @@  discard block
 block discarded – undo
430 430
      */
431 431
     public function check($value)
432 432
     {
433
-        if (!$this->session->has('captcha')) {
433
+        if ( ! $this->session->has('captcha')) {
434 434
             return false;
435 435
         }
436 436
 
437 437
         $key = $this->session->get('captcha.key');
438 438
         $sensitive = $this->session->get('captcha.sensitive');
439 439
 
440
-        if (!$sensitive) {
440
+        if ( ! $sensitive) {
441 441
             $value = $this->str->lower($value);
442 442
         }
443 443
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
      */
470 470
     public function src($config = null)
471 471
     {
472
-        return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8);
472
+        return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8);
473 473
     }
474 474
 
475 475
     /**
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
                 continue;
490 490
             }
491 491
 
492
-            $attrs_str .= $attr . '="' . $value . '" ';
492
+            $attrs_str .= $attr.'="'.$value.'" ';
493 493
         }
494
-        return new HtmlString('<img src="' . $this->src($config) . '" ' . trim($attrs_str) . '>');
494
+        return new HtmlString('<img src="'.$this->src($config).'" '.trim($attrs_str).'>');
495 495
     }
496 496
 }
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!function_exists('captcha')) {
3
+if ( ! function_exists('captcha')) {
4 4
 
5 5
     /**
6 6
      * @param string $config
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     }
13 13
 }
14 14
 
15
-if (!function_exists('captcha_src')) {
15
+if ( ! function_exists('captcha_src')) {
16 16
     /**
17 17
      * @param string $config
18 18
      * @return string
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     }
24 24
 }
25 25
 
26
-if (!function_exists('captcha_img')) {
26
+if ( ! function_exists('captcha_img')) {
27 27
 
28 28
     /**
29 29
      * @param string $config
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     }
36 36
 }
37 37
 
38
-if (!function_exists('captcha_check')) {
38
+if ( ! function_exists('captcha_check')) {
39 39
     /**
40 40
      * @param $value
41 41
      * @return bool
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     }
47 47
 }
48 48
 
49
-if (!function_exists('captcha_api_check')) {
49
+if ( ! function_exists('captcha_api_check')) {
50 50
     /**
51 51
      * @param $value
52 52
      * @return bool
Please login to merge, or discard this patch.
src/CaptchaServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         // Publish configuration files
21 21
         $this->publishes([
22
-            __DIR__ . '/../config/captcha.php' => config_path('captcha.php')
22
+            __DIR__.'/../config/captcha.php' => config_path('captcha.php')
23 23
         ], 'config');
24 24
 
25 25
         // HTTP routing
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             $this->app->get('captcha[/api/{config}]', 'Mews\Captcha\LumenCaptchaController@getCaptchaApi');
28 28
             $this->app->get('captcha[/{config}]', 'Mews\Captcha\LumenCaptchaController@getCaptcha');
29 29
         } else {
30
-            if ((double)$this->app->version() >= 5.2) {
30
+            if ((double) $this->app->version() >= 5.2) {
31 31
                 $this->app['router']->get('captcha/api/{config?}', '\Mews\Captcha\CaptchaController@getCaptchaApi')->middleware('web');
32 32
                 $this->app['router']->get('captcha/{config?}', '\Mews\Captcha\CaptchaController@getCaptcha')->middleware('web');
33 33
             } else {
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
         }
38 38
 
39 39
         // Validator extensions
40
-        $this->app['validator']->extend('captcha', function ($attribute, $value, $parameters) {
40
+        $this->app['validator']->extend('captcha', function($attribute, $value, $parameters) {
41 41
             return captcha_check($value);
42 42
         });
43 43
 
44 44
         // Validator extensions
45
-        $this->app['validator']->extend('captcha_api', function ($attribute, $value, $parameters) {
45
+        $this->app['validator']->extend('captcha_api', function($attribute, $value, $parameters) {
46 46
             return captcha_api_check($value, $parameters[0]);
47 47
         });
48 48
     }
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
     {
57 57
         // Merge configs
58 58
         $this->mergeConfigFrom(
59
-            __DIR__ . '/../config/captcha.php', 'captcha'
59
+            __DIR__.'/../config/captcha.php', 'captcha'
60 60
         );
61 61
 
62 62
         // Bind captcha
63
-        $this->app->bind('captcha', function ($app) {
63
+        $this->app->bind('captcha', function($app) {
64 64
             return new Captcha(
65 65
                 $app['Illuminate\Filesystem\Filesystem'],
66 66
                 $app['Illuminate\Config\Repository'],
Please login to merge, or discard this patch.