Completed
Push — master ( 62e6b0...5482c8 )
by MeWebStudio - Muharrem
08:18
created
src/Captcha.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $this->session = $session;
192 192
         $this->hasher = $hasher;
193 193
         $this->str = $str;
194
-        $this->characters = config('captcha.characters','2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ');
194
+        $this->characters = config('captcha.characters', '2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ');
195 195
     }
196 196
 
197 197
     /**
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
      */
201 201
     protected function configure($config)
202 202
     {
203
-        if ($this->config->has('captcha.' . $config))
203
+        if ($this->config->has('captcha.'.$config))
204 204
         {
205
-            foreach($this->config->get('captcha.' . $config) as $key => $val)
205
+            foreach ($this->config->get('captcha.'.$config) as $key => $val)
206 206
             {
207 207
                 $this->{$key} = $val;
208 208
             }
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public function create($config = 'default')
219 219
     {
220
-        $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds');
221
-        $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts');
220
+        $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds');
221
+        $this->fonts = $this->files->files(__DIR__.'/../assets/fonts');
222 222
         
223
-        if (app()->version() >= 5.5){
223
+        if (app()->version() >= 5.5) {
224 224
             $this->fonts = array_map(function($file) {
225 225
                 return $file->getPathName();
226 226
             }, $this->fonts);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         $characters = str_split($this->characters);
297 297
 
298 298
         $bag = '';
299
-        for($i = 0; $i < $this->length; $i++)
299
+        for ($i = 0; $i < $this->length; $i++)
300 300
         {
301 301
             $bag .= $characters[rand(0, count($characters) - 1)];
302 302
         }
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
         $marginTop = $this->image->height() / $this->length;
318 318
 
319 319
         $i = 0;
320
-        foreach(str_split($this->text) as $char)
320
+        foreach (str_split($this->text) as $char)
321 321
         {
322
-            $marginLeft = $this->textLeftPadding +  ($i * ($this->image->width() - $this->textLeftPadding) / $this->length);
322
+            $marginLeft = $this->textLeftPadding + ($i * ($this->image->width() - $this->textLeftPadding) / $this->length);
323 323
 
324 324
             $this->image->text($char, $marginLeft, $marginTop, function($font) {
325 325
                 $font->file($this->font());
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
      */
391 391
     protected function lines()
392 392
     {
393
-        for($i = 0; $i <= $this->lines; $i++)
393
+        for ($i = 0; $i <= $this->lines; $i++)
394 394
         {
395 395
             $this->image->line(
396 396
                 rand(0, $this->image->width()) + $i * rand(0, $this->image->height()),
397 397
                 rand(0, $this->image->height()),
398 398
                 rand(0, $this->image->width()),
399 399
                 rand(0, $this->image->height()),
400
-                function ($draw) {
400
+                function($draw) {
401 401
                     $draw->color($this->fontColor());
402 402
                 }
403 403
             );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
      */
439 439
     public function src($config = null)
440 440
     {
441
-        return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8);
441
+        return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8);
442 442
     }
443 443
 
444 444
     /**
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
     public function img($config = null, $attrs = [])
453 453
     {
454 454
         $attrs_str = '';
455
-        foreach($attrs as $attr => $value){
456
-            if ($attr == 'src'){
455
+        foreach ($attrs as $attr => $value) {
456
+            if ($attr == 'src') {
457 457
                 //Neglect src attribute
458 458
                 continue;
459 459
             }
460 460
             $attrs_str .= $attr.'="'.$value.'" ';
461 461
         }
462
-        return '<img src="' . $this->src($config) . '" '. trim($attrs_str).'>';
462
+        return '<img src="'.$this->src($config).'" '.trim($attrs_str).'>';
463 463
     }
464 464
 
465 465
 }
Please login to merge, or discard this patch.