Completed
Pull Request — master (#114)
by Yang
23:05
created
src/Captcha.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@
 block discarded – undo
207 207
     /**
208 208
      * Create captcha image
209 209
      *
210
-     * @param null   $text
210
+     * @param string   $text
211 211
      * @param string $config
212 212
      * @return ImageManager->response
213 213
      */
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function create($text = null, $config = 'default')
215 215
     {
216
-        $this->backgrounds = $this->files->files(__DIR__ . '/../assets/backgrounds');
217
-        $this->fonts = $this->files->files(__DIR__ . '/../assets/fonts');
216
+        $this->backgrounds = $this->files->files(__DIR__.'/../assets/backgrounds');
217
+        $this->fonts = $this->files->files(__DIR__.'/../assets/fonts');
218 218
 
219
-        if (app()->version() >= 5.5){
219
+        if (app()->version() >= 5.5) {
220 220
             $this->fonts = array_map(function($file) {
221 221
                 return $file->getPathName();
222 222
             }, $this->fonts);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $characters = str_split($this->characters);
293 293
 
294 294
         $bag = '';
295
-        for($i = 0; $i < $this->length; $i++)
295
+        for ($i = 0; $i < $this->length; $i++)
296 296
         {
297 297
             $bag .= $characters[rand(0, count($characters) - 1)];
298 298
         }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         $marginTop = $this->image->height() / $this->length;
314 314
 
315 315
         $i = 0;
316
-        foreach(str_split($this->text) as $char)
316
+        foreach (str_split($this->text) as $char)
317 317
         {
318 318
             $marginLeft = ($i * $this->image->width() / $this->length);
319 319
 
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
      */
387 387
     protected function lines()
388 388
     {
389
-        for($i = 0; $i <= $this->lines; $i++)
389
+        for ($i = 0; $i <= $this->lines; $i++)
390 390
         {
391 391
             $this->image->line(
392 392
                 rand(0, $this->image->width()) + $i * rand(0, $this->image->height()),
393 393
                 rand(0, $this->image->height()),
394 394
                 rand(0, $this->image->width()),
395 395
                 rand(0, $this->image->height()),
396
-                function ($draw) {
396
+                function($draw) {
397 397
                     $draw->color($this->fontColor());
398 398
                 }
399 399
             );
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      */
435 435
     public function src($config = null)
436 436
     {
437
-        return url('captcha' . ($config ? '/' . $config : '/default')) . '?' . $this->str->random(8);
437
+        return url('captcha'.($config ? '/'.$config : '/default')).'?'.$this->str->random(8);
438 438
     }
439 439
 
440 440
     /**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function img($config = null)
447 447
     {
448
-        return '<img src="' . $this->src($config) . '" alt="captcha">';
448
+        return '<img src="'.$this->src($config).'" alt="captcha">';
449 449
     }
450 450
 
451 451
 }
Please login to merge, or discard this patch.