Passed
Push — master ( 397219...75ccd7 )
by
unknown
01:43
created
src/Captcha.php 1 patch
Spacing   +14 added lines, -14 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
     /**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
         $code = session()->pull('captcha');
165 165
 
166
-        if(config('captcha.sensitive')) {
166
+        if (config('captcha.sensitive')) {
167 167
             if ($input == $code) {
168 168
                 return true;
169 169
             } else {
@@ -185,6 +185,6 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function src()
187 187
     {
188
-        return url('captcha') . '?' . str_random(8);
188
+        return url('captcha').'?'.str_random(8);
189 189
     }
190 190
 }
Please login to merge, or discard this patch.
tests/CaptchaTest.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@
 block discarded – undo
7 7
 
8 8
 class CaptchaTest extends TestCase
9 9
 {
10
-	/**
11
-	 * @var Captcha
12
-	 */
13
-	private $captcha;
10
+    /**
11
+     * @var Captcha
12
+     */
13
+    private $captcha;
14 14
 
15
-	/**
16
-	 * setUp
17
-	 */
18
-	public function setUp()
19
-	{
20
-		parent::setUp();
21
-		$this->captcha = new Captcha();
22
-	}
15
+    /**
16
+     * setUp
17
+     */
18
+    public function setUp()
19
+    {
20
+        parent::setUp();
21
+        $this->captcha = new Captcha();
22
+    }
23 23
 
24
-	/**
25
-	 * Test captcha image.
26
-	 */
27
-	public function testCaptchaImg()
28
-	{
29
-		$this->assertTrue($this->captcha instanceof Captcha);
30
-	}
24
+    /**
25
+     * Test captcha image.
26
+     */
27
+    public function testCaptchaImg()
28
+    {
29
+        $this->assertTrue($this->captcha instanceof Captcha);
30
+    }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.