Passed
Push — master ( aa1ec7...c1c337 )
by Hashem
01:24
created
src/Captcha.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         if (config()->has('captcha'))
75 75
         {
76
-            foreach(config('captcha') as $key => $value)
76
+            foreach (config('captcha') as $key => $value)
77 77
             {
78 78
                 $key = camel_case($key);
79 79
                 $this->{$key} = $value;
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $alphaNumeric = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9));
96 96
         $text = '';
97
-        for ($i=0; $i < $this->length; $i++) {
98
-            $text .= $alphaNumeric[rand(0, count($alphaNumeric) -1)];
97
+        for ($i = 0; $i < $this->length; $i++) {
98
+            $text .= $alphaNumeric[rand(0, count($alphaNumeric)-1)];
99 99
         }
100 100
         //put captcha code into session
101 101
         session(['captcha' => $text]);
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
     protected function hex2rgb() {
112 112
         $hex = str_replace("#", "", $this->fontColor);
113 113
 
114
-        if(strlen($hex) == 3) {
115
-            $r = hexdec(substr($hex,0,1).substr($hex,0,1));
116
-            $g = hexdec(substr($hex,1,1).substr($hex,1,1));
117
-            $b = hexdec(substr($hex,2,1).substr($hex,2,1));
114
+        if (strlen($hex) == 3) {
115
+            $r = hexdec(substr($hex, 0, 1).substr($hex, 0, 1));
116
+            $g = hexdec(substr($hex, 1, 1).substr($hex, 1, 1));
117
+            $b = hexdec(substr($hex, 2, 1).substr($hex, 2, 1));
118 118
         } else {
119
-            $r = hexdec(substr($hex,0,2));
120
-            $g = hexdec(substr($hex,2,2));
121
-            $b = hexdec(substr($hex,4,2));
119
+            $r = hexdec(substr($hex, 0, 2));
120
+            $g = hexdec(substr($hex, 2, 2));
121
+            $b = hexdec(substr($hex, 4, 2));
122 122
         }
123 123
         $rgb = array($r, $g, $b);
124 124
         //return implode(",", $rgb); // returns the rgb values separated by commas
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $this->configure();
134 134
 
135 135
         imagefilledrectangle($this->img, 0, 0, $this->width, $this->height, $this->backColor);
136
-        imagettftext ($this->img, $this->size, -5, 10, 40, $this->fontColor, $this->font, $this->randomText());
136
+        imagettftext($this->img, $this->size, -5, 10, 40, $this->fontColor, $this->font, $this->randomText());
137 137
         header("Content-type: image/png");
138 138
         imagepng($this->img);
139 139
     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function img()
147 147
     {
148
-        return '<img src="' . $this->src() . '" alt="captcha">';
148
+        return '<img src="'.$this->src().'" alt="captcha">';
149 149
     }
150 150
 
151 151
     /**
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         $code = session()->has('captcha') ? session()->pull('captcha') : null;
163 163
 
164 164
         if (config('captcha.sensitive') && $input == $code) {
165
-            $response =  true;
166
-        } elseif ( !config('captcha.sensitive') && strtolower($input) == strtolower($code)) {
167
-            $response =  true;
165
+            $response = true;
166
+        } elseif ( ! config('captcha.sensitive') && strtolower($input) == strtolower($code)) {
167
+            $response = true;
168 168
         }
169 169
 
170 170
         return $response;
@@ -177,6 +177,6 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function src()
179 179
     {
180
-        return url('captcha') . '?' . str_random(8);
180
+        return url('captcha').'?'.str_random(8);
181 181
     }
182 182
 }
Please login to merge, or discard this patch.