Test Failed
Pull Request — master (#21)
by
unknown
09:33
created
tests/TestCase.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,29 +20,29 @@
 block discarded – undo
20 20
  */
21 21
 class TestCase extends OrchestraTestCase {
22 22
 
23
-	/**
24
-	 * Load package alias
25
-	 *
26
-	 * @param  \Illuminate\Foundation\Application $app
27
-	 *
28
-	 * @return array
29
-	 */
30
-	protected function getPackageAliases($app) {
23
+    /**
24
+     * Load package alias
25
+     *
26
+     * @param  \Illuminate\Foundation\Application $app
27
+     *
28
+     * @return array
29
+     */
30
+    protected function getPackageAliases($app) {
31 31
 
32
-		return [
33
-			'ReCaptcha' => ReCaptcha::class,
34
-		];
35
-	}
32
+        return [
33
+            'ReCaptcha' => ReCaptcha::class,
34
+        ];
35
+    }
36 36
 
37
-	/**
38
-	 * Load package service provider
39
-	 *
40
-	 * @param \Illuminate\Foundation\Application $app
41
-	 *
42
-	 * @return array
43
-	 */
44
-	protected function getPackageProviders($app) {
37
+    /**
38
+     * Load package service provider
39
+     *
40
+     * @param \Illuminate\Foundation\Application $app
41
+     *
42
+     * @return array
43
+     */
44
+    protected function getPackageProviders($app) {
45 45
 
46
-		return [ReCaptchaServiceProvider::class];
47
-	}
46
+        return [ReCaptchaServiceProvider::class];
47
+    }
48 48
 }
Please login to merge, or discard this patch.
src/Facades/ReCaptcha.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
18 18
  */
19 19
 class ReCaptcha extends Facade {
20 20
 
21
-	/**
22
-	 * Get the registered name of the component.
23
-	 *
24
-	 * @return string
25
-	 */
26
-	protected static function getFacadeAccessor() {
21
+    /**
22
+     * Get the registered name of the component.
23
+     *
24
+     * @return string
25
+     */
26
+    protected static function getFacadeAccessor() {
27 27
 
28
-		return 'recaptcha';
29
-	}
28
+        return 'recaptcha';
29
+    }
30 30
 }
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 use Biscolab\ReCaptcha\Facades\ReCaptcha;
12 12
 
13 13
 if (!function_exists('recaptcha')) {
14
-	/**
15
-	 * @return Biscolab\ReCaptcha\ReCaptchaBuilder
16
-	 */
17
-	function recaptcha() {
14
+    /**
15
+     * @return Biscolab\ReCaptcha\ReCaptchaBuilder
16
+     */
17
+    function recaptcha() {
18 18
 
19
-		return app('recaptcha');
20
-	}
19
+        return app('recaptcha');
20
+    }
21 21
 }
22 22
 
23 23
 /**
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
  */
30 30
 if (!function_exists('htmlScriptTagJsApi')) {
31 31
 
32
-	/**
33
-	 * @param string $formId
34
-	 *
35
-	 * @return string
36
-	 */
37
-	function htmlScriptTagJsApi($formId = ''): string {
32
+    /**
33
+     * @param string $formId
34
+     *
35
+     * @return string
36
+     */
37
+    function htmlScriptTagJsApi($formId = ''): string {
38 38
 
39
-		return ReCaptcha::htmlScriptTagJsApi($formId);
40
-	}
39
+        return ReCaptcha::htmlScriptTagJsApi($formId);
40
+    }
41 41
 }
42 42
 
43 43
 /**
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
  */
50 50
 if (!function_exists('htmlScriptTagJsApiV3')) {
51 51
 
52
-	/**
53
-	 * @param array $config
54
-	 *
55
-	 * @return string
56
-	 */
57
-	function htmlScriptTagJsApiV3($config = []): string {
52
+    /**
53
+     * @param array $config
54
+     *
55
+     * @return string
56
+     */
57
+    function htmlScriptTagJsApiV3($config = []): string {
58 58
 
59
-		return ReCaptcha::htmlScriptTagJsApiV3($config);
60
-	}
59
+        return ReCaptcha::htmlScriptTagJsApiV3($config);
60
+    }
61 61
 }
62 62
 
63 63
 /**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
  */
72 72
 if (!function_exists('htmlFormButton')) {
73 73
 
74
-	/**
75
-	 * @param null|string $buttonInnerHTML
76
-	 *
77
-	 * @return string
78
-	 */
79
-	function htmlFormButton(?string $buttonInnerHTML = 'Submit'): string {
74
+    /**
75
+     * @param null|string $buttonInnerHTML
76
+     *
77
+     * @return string
78
+     */
79
+    function htmlFormButton(?string $buttonInnerHTML = 'Submit'): string {
80 80
 
81
-		return ReCaptcha::htmlFormButton($buttonInnerHTML);
82
-	}
81
+        return ReCaptcha::htmlFormButton($buttonInnerHTML);
82
+    }
83 83
 }
84 84
 
85 85
 /**
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
  */
92 92
 if (!function_exists('htmlFormSnippet')) {
93 93
 
94
-	/**
95
-	 * @return string
96
-	 */
97
-	function htmlFormSnippet(): string {
94
+    /**
95
+     * @return string
96
+     */
97
+    function htmlFormSnippet(): string {
98 98
 
99
-		return ReCaptcha::htmlFormSnippet();
100
-	}
99
+        return ReCaptcha::htmlFormSnippet();
100
+    }
101 101
 }
102 102
 
Please login to merge, or discard this patch.
src/Controllers/ReCaptchaController.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@
 block discarded – undo
18 18
  */
19 19
 class ReCaptchaController extends Controller {
20 20
 
21
-	/**
22
-	 * @return array
23
-	 */
24
-	public function validateV3(): array {
21
+    /**
22
+     * @return array
23
+     */
24
+    public function validateV3(): array {
25 25
 
26
-		$token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), '');
27
-		return recaptcha()->validate($token);
28
-	}
26
+        $token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), '');
27
+        return recaptcha()->validate($token);
28
+    }
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
src/ReCaptchaBuilder.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	public function getIpWhitelist() {
117 117
 		$whitelist = config('recaptcha.skip_ip', []);
118 118
 
119
-		if(!is_array($whitelist)) {
119
+		if (!is_array($whitelist)) {
120 120
 			$whitelist = explode(',', $whitelist);
121 121
 		}
122 122
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			}
164 164
 			$html .= '<script>
165 165
 		       function biscolabLaravelReCaptcha(token) {
166
-		         document.getElementById("' . $formId . '").submit();
166
+		         document.getElementById("' . $formId.'").submit();
167 167
 		       }
168 168
 		     </script>';
169 169
 		}
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				$js_callback_catch = ($js_callback_catch) ? "{$js_callback_catch}(err)" : '';
188 188
 
189 189
 				$validate_function = "
190
-                fetch('/" . config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate') . "?" . config('recaptcha.default_token_parameter_name', 'token') . "=' + token, {
190
+                fetch('/" . config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate')."?".config('recaptcha.default_token_parameter_name', 'token')."=' + token, {
191 191
                     headers: {
192 192
                         \"X-Requested-With\": \"XMLHttpRequest\",
193 193
                         \"X-CSRF-TOKEN\": csrfToken.content
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			'response' => $response,
253 253
 		]);
254 254
 
255
-		$url = $this->api_url . '?' . $params;
255
+		$url = $this->api_url.'?'.$params;
256 256
 
257 257
 		if (function_exists('curl_version')) {
258 258
 			$curl = curl_init($url);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -166,8 +166,7 @@  discard block
 block discarded – undo
166 166
 		         document.getElementById("' . $formId . '").submit();
167 167
 		       }
168 168
 		     </script>';
169
-		}
170
-		elseif ($this->version == 'v3') {
169
+		} elseif ($this->version == 'v3') {
171 170
 
172 171
 			$action = array_get($configuration, 'action', 'homepage');
173 172
 
@@ -177,8 +176,7 @@  discard block
 block discarded – undo
177 176
 			if ($js_custom_validation) {
178 177
 
179 178
 				$validate_function = ($js_custom_validation) ? "{$js_custom_validation}(token);" : '';
180
-			}
181
-			else {
179
+			} else {
182 180
 
183 181
 				$js_then_callback = array_get($configuration, 'callback_then', '');
184 182
 				$js_callback_catch = array_get($configuration, 'callback_catch', '');
@@ -261,8 +259,7 @@  discard block
 block discarded – undo
261 259
 			curl_setopt($curl, CURLOPT_TIMEOUT, 1);
262 260
 			curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
263 261
 			$curl_response = curl_exec($curl);
264
-		}
265
-		else {
262
+		} else {
266 263
 			$curl_response = file_get_contents($url);
267 264
 		}
268 265
 
Please login to merge, or discard this patch.
Indentation   +278 added lines, -278 removed lines patch added patch discarded remove patch
@@ -14,207 +14,207 @@  discard block
 block discarded – undo
14 14
 
15 15
 class ReCaptchaBuilder {
16 16
 
17
-	/**
18
-	 * The Site key
19
-	 * please visit https://developers.google.com/recaptcha/docs/start
20
-	 * @var string
21
-	 */
22
-	protected $api_site_key;
23
-
24
-	/**
25
-	 * The Secret key
26
-	 * please visit https://developers.google.com/recaptcha/docs/start
27
-	 * @var string
28
-	 */
29
-	protected $api_secret_key;
30
-
31
-	/**
32
-	 * The chosen ReCAPTCHA version
33
-	 * please visit https://developers.google.com/recaptcha/docs/start
34
-	 * @var string
35
-	 */
36
-	protected $version;
37
-
38
-	/**
39
-	 * The chosen ReCAPTCHA language
40
-	 * please visit https://developers.google.com/recaptcha/docs/language
41
-	 * @var string
42
-	 */
43
-	protected $language;
44
-
45
-	/**
46
-	 * Whether is true the ReCAPTCHA is inactive
47
-	 * @var boolean
48
-	 */
49
-	protected $skip_by_ip = false;
50
-
51
-	/**
52
-	 * The API request URI
53
-	 */
54
-	protected $api_url = 'https://www.google.com/recaptcha/api/siteverify';
55
-
56
-	public function __construct($api_site_key, $api_secret_key, $version = 'v2', $language = 'en') {
57
-
58
-		$this->setApiSiteKey($api_site_key);
59
-		$this->setApiSecretKey($api_secret_key);
60
-		$this->setVersion($version);
61
-		$this->setLanguage($language);
62
-		$this->setSkipByIp($this->skipByIp());
63
-	}
64
-
65
-	/**
66
-	 * @param string $api_site_key
67
-	 *
68
-	 * @return ReCaptchaBuilder
69
-	 */
70
-	public function setApiSiteKey(string $api_site_key): ReCaptchaBuilder {
71
-
72
-		$this->api_site_key = $api_site_key;
73
-
74
-		return $this;
75
-	}
76
-
77
-	/**
78
-	 * @param string $api_secret_key
79
-	 *
80
-	 * @return ReCaptchaBuilder
81
-	 */
82
-	public function setApiSecretKey(string $api_secret_key): ReCaptchaBuilder {
83
-
84
-		$this->api_secret_key = $api_secret_key;
85
-
86
-		return $this;
87
-	}
88
-
89
-	/**
90
-	 * @param string $version
91
-	 *
92
-	 * @return ReCaptchaBuilder
93
-	 */
94
-	public function setVersion(string $version): ReCaptchaBuilder {
95
-
96
-		$this->version = $version;
97
-
98
-		return $this;
99
-	}
100
-
101
-	/**
102
-	 * @param string $language
103
-	 *
104
-	 * @return ReCaptchaBuilder
105
-	 */
106
-	public function setLanguage(string $language): ReCaptchaBuilder {
107
-
108
-		$this->language = $language;
109
-
110
-		return $this;
111
-	}
112
-
113
-	/**
114
-	 * @return string
115
-	 */
116
-	public function getVersion(): string {
117
-
118
-		return $this->version;
119
-	}
120
-
121
-	/**
122
-	 * @return string
123
-	 */
124
-	public function getLanguage(): string {
125
-
126
-		return $this->language;
127
-	}
128
-
129
-	/**
130
-	 * @param bool $skip_by_ip
131
-	 *
132
-	 * @return ReCaptchaBuilder
133
-	 */
134
-	public function setSkipByIp(bool $skip_by_ip): ReCaptchaBuilder {
135
-
136
-		$this->skip_by_ip = $skip_by_ip;
137
-
138
-		return $this;
139
-	}
140
-
141
-	/**
142
-	 * @return array|mixed
143
-	 */
144
-	public function getIpWhitelist() {
145
-		$whitelist = config('recaptcha.skip_ip', []);
146
-
147
-		if(!is_array($whitelist)) {
148
-			$whitelist = explode(',', $whitelist);
149
-		}
150
-
151
-		return $whitelist;
152
-	}
153
-
154
-	/**
155
-	 * Checks whether the user IP address is among IPs "to be skipped"
156
-	 *
157
-	 * @return boolean
158
-	 */
159
-	public function skipByIp(): bool {
160
-
161
-		return (in_array(request()->ip(), $this->getIpWhitelist()));
162
-	}
163
-
164
-	/**
165
-	 * Write script HTML tag in you HTML code
166
-	 * Insert before </head> tag
167
-	 *
168
-	 * @param string|null $formId
169
-	 * @param array|null  $configuration
170
-	 *
171
-	 * @return string
172
-	 * @throws Exception
173
-	 */
174
-	public function htmlScriptTagJsApi(?string $formId = '', ?array $configuration = []): string {
175
-
176
-		if ($this->skip_by_ip) {
177
-			return '';
178
-		}
179
-
180
-		switch ($this->version) {
181
-			case 'v3':
182
-				$html = "<script src=\"https://www.google.com/recaptcha/api.js?hl={$this->language}&render={$this->api_site_key}\"></script>";
183
-				break;
184
-			default:
185
-				$html = "<script src=\"https://www.google.com/recaptcha/api.js?hl={$this->language}\" async defer></script>";
186
-		}
187
-
188
-		if ($this->version == 'invisible') {
189
-			if (!$formId) {
190
-				throw new Exception("formId required", 1);
191
-			}
192
-			$html .= '<script>
17
+    /**
18
+     * The Site key
19
+     * please visit https://developers.google.com/recaptcha/docs/start
20
+     * @var string
21
+     */
22
+    protected $api_site_key;
23
+
24
+    /**
25
+     * The Secret key
26
+     * please visit https://developers.google.com/recaptcha/docs/start
27
+     * @var string
28
+     */
29
+    protected $api_secret_key;
30
+
31
+    /**
32
+     * The chosen ReCAPTCHA version
33
+     * please visit https://developers.google.com/recaptcha/docs/start
34
+     * @var string
35
+     */
36
+    protected $version;
37
+
38
+    /**
39
+     * The chosen ReCAPTCHA language
40
+     * please visit https://developers.google.com/recaptcha/docs/language
41
+     * @var string
42
+     */
43
+    protected $language;
44
+
45
+    /**
46
+     * Whether is true the ReCAPTCHA is inactive
47
+     * @var boolean
48
+     */
49
+    protected $skip_by_ip = false;
50
+
51
+    /**
52
+     * The API request URI
53
+     */
54
+    protected $api_url = 'https://www.google.com/recaptcha/api/siteverify';
55
+
56
+    public function __construct($api_site_key, $api_secret_key, $version = 'v2', $language = 'en') {
57
+
58
+        $this->setApiSiteKey($api_site_key);
59
+        $this->setApiSecretKey($api_secret_key);
60
+        $this->setVersion($version);
61
+        $this->setLanguage($language);
62
+        $this->setSkipByIp($this->skipByIp());
63
+    }
64
+
65
+    /**
66
+     * @param string $api_site_key
67
+     *
68
+     * @return ReCaptchaBuilder
69
+     */
70
+    public function setApiSiteKey(string $api_site_key): ReCaptchaBuilder {
71
+
72
+        $this->api_site_key = $api_site_key;
73
+
74
+        return $this;
75
+    }
76
+
77
+    /**
78
+     * @param string $api_secret_key
79
+     *
80
+     * @return ReCaptchaBuilder
81
+     */
82
+    public function setApiSecretKey(string $api_secret_key): ReCaptchaBuilder {
83
+
84
+        $this->api_secret_key = $api_secret_key;
85
+
86
+        return $this;
87
+    }
88
+
89
+    /**
90
+     * @param string $version
91
+     *
92
+     * @return ReCaptchaBuilder
93
+     */
94
+    public function setVersion(string $version): ReCaptchaBuilder {
95
+
96
+        $this->version = $version;
97
+
98
+        return $this;
99
+    }
100
+
101
+    /**
102
+     * @param string $language
103
+     *
104
+     * @return ReCaptchaBuilder
105
+     */
106
+    public function setLanguage(string $language): ReCaptchaBuilder {
107
+
108
+        $this->language = $language;
109
+
110
+        return $this;
111
+    }
112
+
113
+    /**
114
+     * @return string
115
+     */
116
+    public function getVersion(): string {
117
+
118
+        return $this->version;
119
+    }
120
+
121
+    /**
122
+     * @return string
123
+     */
124
+    public function getLanguage(): string {
125
+
126
+        return $this->language;
127
+    }
128
+
129
+    /**
130
+     * @param bool $skip_by_ip
131
+     *
132
+     * @return ReCaptchaBuilder
133
+     */
134
+    public function setSkipByIp(bool $skip_by_ip): ReCaptchaBuilder {
135
+
136
+        $this->skip_by_ip = $skip_by_ip;
137
+
138
+        return $this;
139
+    }
140
+
141
+    /**
142
+     * @return array|mixed
143
+     */
144
+    public function getIpWhitelist() {
145
+        $whitelist = config('recaptcha.skip_ip', []);
146
+
147
+        if(!is_array($whitelist)) {
148
+            $whitelist = explode(',', $whitelist);
149
+        }
150
+
151
+        return $whitelist;
152
+    }
153
+
154
+    /**
155
+     * Checks whether the user IP address is among IPs "to be skipped"
156
+     *
157
+     * @return boolean
158
+     */
159
+    public function skipByIp(): bool {
160
+
161
+        return (in_array(request()->ip(), $this->getIpWhitelist()));
162
+    }
163
+
164
+    /**
165
+     * Write script HTML tag in you HTML code
166
+     * Insert before </head> tag
167
+     *
168
+     * @param string|null $formId
169
+     * @param array|null  $configuration
170
+     *
171
+     * @return string
172
+     * @throws Exception
173
+     */
174
+    public function htmlScriptTagJsApi(?string $formId = '', ?array $configuration = []): string {
175
+
176
+        if ($this->skip_by_ip) {
177
+            return '';
178
+        }
179
+
180
+        switch ($this->version) {
181
+            case 'v3':
182
+                $html = "<script src=\"https://www.google.com/recaptcha/api.js?hl={$this->language}&render={$this->api_site_key}\"></script>";
183
+                break;
184
+            default:
185
+                $html = "<script src=\"https://www.google.com/recaptcha/api.js?hl={$this->language}\" async defer></script>";
186
+        }
187
+
188
+        if ($this->version == 'invisible') {
189
+            if (!$formId) {
190
+                throw new Exception("formId required", 1);
191
+            }
192
+            $html .= '<script>
193 193
 		       function biscolabLaravelReCaptcha(token) {
194 194
 		         document.getElementById("' . $formId . '").submit();
195 195
 		       }
196 196
 		     </script>';
197
-		}
198
-		elseif ($this->version == 'v3') {
197
+        }
198
+        elseif ($this->version == 'v3') {
199 199
 
200
-			$action = array_get($configuration, 'action', 'homepage');
200
+            $action = array_get($configuration, 'action', 'homepage');
201 201
 
202
-			$js_custom_validation = array_get($configuration, 'custom_validation', '');
202
+            $js_custom_validation = array_get($configuration, 'custom_validation', '');
203 203
 
204
-			// Check if set custom_validation. That function will override default fetch validation function
205
-			if ($js_custom_validation) {
204
+            // Check if set custom_validation. That function will override default fetch validation function
205
+            if ($js_custom_validation) {
206 206
 
207
-				$validate_function = ($js_custom_validation) ? "{$js_custom_validation}(token);" : '';
208
-			}
209
-			else {
207
+                $validate_function = ($js_custom_validation) ? "{$js_custom_validation}(token);" : '';
208
+            }
209
+            else {
210 210
 
211
-				$js_then_callback = array_get($configuration, 'callback_then', '');
212
-				$js_callback_catch = array_get($configuration, 'callback_catch', '');
211
+                $js_then_callback = array_get($configuration, 'callback_then', '');
212
+                $js_callback_catch = array_get($configuration, 'callback_catch', '');
213 213
 
214
-				$js_then_callback = ($js_then_callback) ? "{$js_then_callback}(response)" : '';
215
-				$js_callback_catch = ($js_callback_catch) ? "{$js_callback_catch}(err)" : '';
214
+                $js_then_callback = ($js_then_callback) ? "{$js_then_callback}(response)" : '';
215
+                $js_callback_catch = ($js_callback_catch) ? "{$js_callback_catch}(err)" : '';
216 216
 
217
-				$validate_function = "
217
+                $validate_function = "
218 218
                 fetch('/" . config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate') . "?" . config('recaptcha.default_token_parameter_name', 'token') . "=' + token, {
219 219
                     headers: {
220 220
                         \"X-Requested-With\": \"XMLHttpRequest\",
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
                 .catch(function(err) {
228 228
                     {$js_callback_catch}
229 229
                 });";
230
-			}
230
+            }
231 231
 
232
-			$html .= "<script>
232
+            $html .= "<script>
233 233
                     var csrfToken = document.head.querySelector('meta[name=\"csrf-token\"]');
234 234
                   grecaptcha.ready(function() {
235 235
                       grecaptcha.execute('{$this->api_site_key}', {action: '{$action}'}).then(function(token) {
@@ -237,90 +237,90 @@  discard block
 block discarded – undo
237 237
                       });
238 238
                   });
239 239
 		     </script>";
240
-		}
241
-
242
-		return $html;
243
-	}
244
-
245
-	/**
246
-	 * @param array|null $configuration
247
-	 *
248
-	 * @return string
249
-	 */
250
-	public function htmlScriptTagJsApiV3(?array $configuration = []): string {
251
-
252
-		return $this->htmlScriptTagJsApi('', $configuration);
253
-	}
254
-
255
-	/**
256
-	 * Call out to reCAPTCHA and process the response
257
-	 *
258
-	 * @param string $response
259
-	 *
260
-	 * @return boolean|array
261
-	 */
262
-	public function validate($response) {
263
-
264
-		if ($this->skip_by_ip) {
265
-			if ($this->returnArray()) {
266
-				// Add 'skip_by_ip' field to response
267
-				return [
268
-					'skip_by_ip' => true,
269
-					'score'      => 0.9,
270
-					'success'    => true
271
-				];
272
-			}
273
-
274
-			return true;
275
-		}
276
-
277
-		$params = http_build_query([
278
-			'secret'   => $this->api_secret_key,
279
-			'remoteip' => request()->getClientIp(),
280
-			'response' => $response,
281
-		]);
282
-
283
-		$url = $this->api_url . '?' . $params;
284
-
285
-		if (function_exists('curl_version')) {
286
-			$curl = curl_init($url);
287
-			curl_setopt($curl, CURLOPT_HEADER, false);
288
-			curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
289
-			curl_setopt($curl, CURLOPT_TIMEOUT, 1);
290
-			curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
291
-			$curl_response = curl_exec($curl);
292
-		}
293
-		else {
294
-			$curl_response = file_get_contents($url);
295
-		}
296
-
297
-		if (is_null($curl_response) || empty($curl_response)) {
298
-			if ($this->returnArray()) {
299
-				// Add 'error' field to response
300
-				return [
301
-					'error'   => 'cURL response empty',
302
-					'score'   => 0.1,
303
-					'success' => false
304
-				];
305
-			}
306
-
307
-			return false;
308
-		}
309
-		$response = json_decode(trim($curl_response), true);
310
-
311
-		if ($this->returnArray()) {
312
-			return $response;
313
-		}
314
-
315
-		return $response['success'];
316
-
317
-	}
318
-
319
-	/**
320
-	 * @return bool
321
-	 */
322
-	protected function returnArray(): bool {
323
-
324
-		return ($this->version == 'v3');
325
-	}
240
+        }
241
+
242
+        return $html;
243
+    }
244
+
245
+    /**
246
+     * @param array|null $configuration
247
+     *
248
+     * @return string
249
+     */
250
+    public function htmlScriptTagJsApiV3(?array $configuration = []): string {
251
+
252
+        return $this->htmlScriptTagJsApi('', $configuration);
253
+    }
254
+
255
+    /**
256
+     * Call out to reCAPTCHA and process the response
257
+     *
258
+     * @param string $response
259
+     *
260
+     * @return boolean|array
261
+     */
262
+    public function validate($response) {
263
+
264
+        if ($this->skip_by_ip) {
265
+            if ($this->returnArray()) {
266
+                // Add 'skip_by_ip' field to response
267
+                return [
268
+                    'skip_by_ip' => true,
269
+                    'score'      => 0.9,
270
+                    'success'    => true
271
+                ];
272
+            }
273
+
274
+            return true;
275
+        }
276
+
277
+        $params = http_build_query([
278
+            'secret'   => $this->api_secret_key,
279
+            'remoteip' => request()->getClientIp(),
280
+            'response' => $response,
281
+        ]);
282
+
283
+        $url = $this->api_url . '?' . $params;
284
+
285
+        if (function_exists('curl_version')) {
286
+            $curl = curl_init($url);
287
+            curl_setopt($curl, CURLOPT_HEADER, false);
288
+            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
289
+            curl_setopt($curl, CURLOPT_TIMEOUT, 1);
290
+            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
291
+            $curl_response = curl_exec($curl);
292
+        }
293
+        else {
294
+            $curl_response = file_get_contents($url);
295
+        }
296
+
297
+        if (is_null($curl_response) || empty($curl_response)) {
298
+            if ($this->returnArray()) {
299
+                // Add 'error' field to response
300
+                return [
301
+                    'error'   => 'cURL response empty',
302
+                    'score'   => 0.1,
303
+                    'success' => false
304
+                ];
305
+            }
306
+
307
+            return false;
308
+        }
309
+        $response = json_decode(trim($curl_response), true);
310
+
311
+        if ($this->returnArray()) {
312
+            return $response;
313
+        }
314
+
315
+        return $response['success'];
316
+
317
+    }
318
+
319
+    /**
320
+     * @return bool
321
+     */
322
+    protected function returnArray(): bool {
323
+
324
+        return ($this->version == 'v3');
325
+    }
326 326
 }
327 327
\ No newline at end of file
Please login to merge, or discard this patch.
src/ReCaptchaServiceProvider.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 //		$this->loadRoutesFrom(__DIR__ . '/routes/routes.php');
37 37
 		$this->registerRoutes();
38 38
 		$this->publishes([
39
-			__DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'),
39
+			__DIR__.'/../config/recaptcha.php' => config_path('recaptcha.php'),
40 40
 		]);
41 41
 
42 42
 	}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function addValidationRule() {
48 48
 
49
-		Validator::extendImplicit('recaptcha', function ($attribute, $value, $parameters, $validator) {
49
+		Validator::extendImplicit('recaptcha', function($attribute, $value, $parameters, $validator) {
50 50
 
51 51
 			return app('recaptcha')->validate($value);
52 52
 		}, trans('validation.recaptcha'));
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function register() {
61 61
 
62 62
 		$this->mergeConfigFrom(
63
-			__DIR__ . '/../config/recaptcha.php', 'recaptcha'
63
+			__DIR__.'/../config/recaptcha.php', 'recaptcha'
64 64
 		);
65 65
 
66 66
 		$this->registerReCaptchaBuilder();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	protected function registerReCaptchaBuilder() {
98 98
 
99
-		$this->app->singleton('recaptcha', function ($app) {
99
+		$this->app->singleton('recaptcha', function($app) {
100 100
 
101 101
 			$recaptcha_class = '';
102 102
 
Please login to merge, or discard this patch.
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -20,103 +20,103 @@
 block discarded – undo
20 20
  */
21 21
 class ReCaptchaServiceProvider extends ServiceProvider {
22 22
 
23
-	/**
24
-	 * Indicates if loading of the provider is deferred.
25
-	 *
26
-	 * @var bool
27
-	 */
28
-	protected $defer = false;
29
-
30
-	/**
31
-	 *
32
-	 */
33
-	public function boot() {
34
-
35
-		$this->addValidationRule();
23
+    /**
24
+     * Indicates if loading of the provider is deferred.
25
+     *
26
+     * @var bool
27
+     */
28
+    protected $defer = false;
29
+
30
+    /**
31
+     *
32
+     */
33
+    public function boot() {
34
+
35
+        $this->addValidationRule();
36 36
 //		$this->loadRoutesFrom(__DIR__ . '/routes/routes.php');
37
-		$this->registerRoutes();
38
-		$this->publishes([
39
-			__DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'),
40
-		]);
41
-
42
-	}
43
-
44
-	/**
45
-	 * Extends Validator to include a recaptcha type
46
-	 */
47
-	public function addValidationRule() {
48
-
49
-		Validator::extendImplicit('recaptcha', function ($attribute, $value, $parameters, $validator) {
50
-
51
-			return app('recaptcha')->validate($value);
52
-		}, trans('validation.recaptcha'));
53
-	}
54
-
55
-	/**
56
-	 * Register the service provider.
57
-	 *
58
-	 * @return void
59
-	 */
60
-	public function register() {
61
-
62
-		$this->mergeConfigFrom(
63
-			__DIR__ . '/../config/recaptcha.php', 'recaptcha'
64
-		);
65
-
66
-		$this->registerReCaptchaBuilder();
67
-	}
68
-
69
-	/**
70
-	 * Get the services provided by the provider.
71
-	 *
72
-	 * @return array
73
-	 */
74
-	public function provides(): array {
75
-
76
-		return ['recaptcha'];
77
-	}
78
-
79
-	/**
80
-	 * @return ReCaptchaServiceProvider
81
-	 *
82
-	 * @since v3.4.1
83
-	 */
84
-	protected function registerRoutes(): ReCaptchaServiceProvider {
85
-
86
-		Route::get(
87
-			config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'),
88
-			['uses' => 'Biscolab\ReCaptcha\Controllers\ReCaptchaController@validateV3']
89
-		)->middleware('web');
90
-
91
-		return $this;
92
-	}
93
-
94
-	/**
95
-	 * Register the HTML builder instance.
96
-	 *
97
-	 * @return void
98
-	 */
99
-	protected function registerReCaptchaBuilder() {
100
-
101
-		$this->app->singleton('recaptcha', function ($app) {
102
-
103
-			$recaptcha_class = '';
104
-
105
-			switch (config('recaptcha.version')) {
106
-				case 'v3' :
107
-					$recaptcha_class = ReCaptchaBuilderV3::class;
108
-					break;
109
-				case 'v2' :
110
-					$recaptcha_class = ReCaptchaBuilderV2::class;
111
-					break;
112
-				case 'invisible':
113
-					$recaptcha_class = ReCaptchaBuilderInvisible::class;
114
-					break;
115
-			}
116
-
117
-			return new $recaptcha_class(config('recaptcha.api_site_key'), config('recaptcha.api_secret_key'));
118
-
119
-		});
120
-	}
37
+        $this->registerRoutes();
38
+        $this->publishes([
39
+            __DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'),
40
+        ]);
41
+
42
+    }
43
+
44
+    /**
45
+     * Extends Validator to include a recaptcha type
46
+     */
47
+    public function addValidationRule() {
48
+
49
+        Validator::extendImplicit('recaptcha', function ($attribute, $value, $parameters, $validator) {
50
+
51
+            return app('recaptcha')->validate($value);
52
+        }, trans('validation.recaptcha'));
53
+    }
54
+
55
+    /**
56
+     * Register the service provider.
57
+     *
58
+     * @return void
59
+     */
60
+    public function register() {
61
+
62
+        $this->mergeConfigFrom(
63
+            __DIR__ . '/../config/recaptcha.php', 'recaptcha'
64
+        );
65
+
66
+        $this->registerReCaptchaBuilder();
67
+    }
68
+
69
+    /**
70
+     * Get the services provided by the provider.
71
+     *
72
+     * @return array
73
+     */
74
+    public function provides(): array {
75
+
76
+        return ['recaptcha'];
77
+    }
78
+
79
+    /**
80
+     * @return ReCaptchaServiceProvider
81
+     *
82
+     * @since v3.4.1
83
+     */
84
+    protected function registerRoutes(): ReCaptchaServiceProvider {
85
+
86
+        Route::get(
87
+            config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'),
88
+            ['uses' => 'Biscolab\ReCaptcha\Controllers\ReCaptchaController@validateV3']
89
+        )->middleware('web');
90
+
91
+        return $this;
92
+    }
93
+
94
+    /**
95
+     * Register the HTML builder instance.
96
+     *
97
+     * @return void
98
+     */
99
+    protected function registerReCaptchaBuilder() {
100
+
101
+        $this->app->singleton('recaptcha', function ($app) {
102
+
103
+            $recaptcha_class = '';
104
+
105
+            switch (config('recaptcha.version')) {
106
+                case 'v3' :
107
+                    $recaptcha_class = ReCaptchaBuilderV3::class;
108
+                    break;
109
+                case 'v2' :
110
+                    $recaptcha_class = ReCaptchaBuilderV2::class;
111
+                    break;
112
+                case 'invisible':
113
+                    $recaptcha_class = ReCaptchaBuilderInvisible::class;
114
+                    break;
115
+            }
116
+
117
+            return new $recaptcha_class(config('recaptcha.api_site_key'), config('recaptcha.api_secret_key'));
118
+
119
+        });
120
+    }
121 121
 
122 122
 }
Please login to merge, or discard this patch.
tests/ReCaptchaConfigurationTest.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,40 +22,40 @@
 block discarded – undo
22 22
  */
23 23
 class ReCaptchaConfigurationTest extends TestCase {
24 24
 
25
-	/**
26
-	 * @var ReCaptchaBuilder
27
-	 */
28
-	protected $recaptcha;
29
-
30
-	/**
31
-	 * @test
32
-	 */
33
-	public function testSkipIpWhiteListIsArray() {
34
-
35
-		$ip_whitelist = $this->recaptcha->getIpWhitelist();
36
-		$this->assertTrue(is_array($ip_whitelist));
37
-		$this->assertCount(2, $ip_whitelist);
38
-	}
39
-
40
-	/**
41
-	 * Define environment setup.
42
-	 *
43
-	 * @param  \Illuminate\Foundation\Application $app
44
-	 *
45
-	 * @return void
46
-	 */
47
-	protected function getEnvironmentSetUp($app) {
48
-
49
-		$app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2');
50
-	}
51
-
52
-	/**
53
-	 * Setup the test environment.
54
-	 */
55
-	protected function setUp(): void {
56
-
57
-		parent::setUp(); // TODO: Change the autogenerated stub
58
-
59
-		$this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
60
-	}
25
+    /**
26
+     * @var ReCaptchaBuilder
27
+     */
28
+    protected $recaptcha;
29
+
30
+    /**
31
+     * @test
32
+     */
33
+    public function testSkipIpWhiteListIsArray() {
34
+
35
+        $ip_whitelist = $this->recaptcha->getIpWhitelist();
36
+        $this->assertTrue(is_array($ip_whitelist));
37
+        $this->assertCount(2, $ip_whitelist);
38
+    }
39
+
40
+    /**
41
+     * Define environment setup.
42
+     *
43
+     * @param  \Illuminate\Foundation\Application $app
44
+     *
45
+     * @return void
46
+     */
47
+    protected function getEnvironmentSetUp($app) {
48
+
49
+        $app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2');
50
+    }
51
+
52
+    /**
53
+     * Setup the test environment.
54
+     */
55
+    protected function setUp(): void {
56
+
57
+        parent::setUp(); // TODO: Change the autogenerated stub
58
+
59
+        $this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
60
+    }
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
tests/ReCaptchaV3Test.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -20,93 +20,93 @@
 block discarded – undo
20 20
  */
21 21
 class ReCaptchaV3Test extends TestCase {
22 22
 
23
-	protected $recaptcha_v3 = null;
24
-
25
-	/**
26
-	 * @test
27
-	 */
28
-	public function testGetApiVersion() {
29
-
30
-		$this->assertEquals($this->recaptcha_v3->getVersion(), 'v3');
31
-	}
32
-
33
-	/**
34
-	 * @test
35
-	 */
36
-	public function testHtmlScriptTagJsApiV3GetHtmlScriptTag() {
37
-
38
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3();
39
-		$this->assertRegexp('/csrfToken/', $r);
40
-	}
41
-
42
-	/**
43
-	 * @test
44
-	 */
45
-	public function testAction() {
46
-
47
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['action' => 'someAction']);
48
-		$this->assertRegexp('/someAction/', $r);
49
-	}
50
-
51
-	/**
52
-	 * @test
53
-	 */
54
-	public function testFetchCallbackFunction() {
55
-
56
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_then' => 'functionCallbackThen']);
57
-		$this->assertRegexp('/functionCallbackThen\(response\)/', $r);
58
-	}
59
-
60
-	/**
61
-	 * @test
62
-	 */
63
-	public function testcCatchCallbackFunction() {
64
-
65
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_catch' => 'functionCallbackCatch']);
66
-		$this->assertRegexp('/functionCallbackCatch\(err\)/', $r);
67
-	}
68
-
69
-	/**
70
-	 * @test
71
-	 */
72
-	public function testCustomValidationFunction() {
73
-
74
-		$r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['custom_validation' => 'functionCustomValidation']);
75
-		$this->assertRegexp('/functionCustomValidation\(token\)/', $r);
76
-	}
77
-
78
-	/**
79
-	 * @test
80
-	 */
81
-	public function testValidateController() {
82
-
83
-		$controller = App::make(ReCaptchaController::class);
84
-		$return = $controller->validateV3();
85
-
86
-		$this->assertArrayHasKey("success", $return);
87
-		$this->assertArrayHasKey("error-codes", $return);
88
-	}
89
-
90
-	/**
91
-	 * Define environment setup.
92
-	 *
93
-	 * @param  \Illuminate\Foundation\Application $app
94
-	 *
95
-	 * @return void
96
-	 */
97
-	protected function getEnvironmentSetUp($app) {
98
-
99
-		$app['config']->set('recaptcha.version', 'v3');
100
-	}
101
-
102
-	/**
103
-	 * Setup the test environment.
104
-	 */
105
-	protected function setUp(): void {
106
-
107
-		parent::setUp(); // TODO: Change the autogenerated stub
108
-
109
-		$this->recaptcha_v3 = new ReCaptchaBuilderV3('api_site_key', 'api_secret_key');
110
-
111
-	}
23
+    protected $recaptcha_v3 = null;
24
+
25
+    /**
26
+     * @test
27
+     */
28
+    public function testGetApiVersion() {
29
+
30
+        $this->assertEquals($this->recaptcha_v3->getVersion(), 'v3');
31
+    }
32
+
33
+    /**
34
+     * @test
35
+     */
36
+    public function testHtmlScriptTagJsApiV3GetHtmlScriptTag() {
37
+
38
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3();
39
+        $this->assertRegexp('/csrfToken/', $r);
40
+    }
41
+
42
+    /**
43
+     * @test
44
+     */
45
+    public function testAction() {
46
+
47
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['action' => 'someAction']);
48
+        $this->assertRegexp('/someAction/', $r);
49
+    }
50
+
51
+    /**
52
+     * @test
53
+     */
54
+    public function testFetchCallbackFunction() {
55
+
56
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_then' => 'functionCallbackThen']);
57
+        $this->assertRegexp('/functionCallbackThen\(response\)/', $r);
58
+    }
59
+
60
+    /**
61
+     * @test
62
+     */
63
+    public function testcCatchCallbackFunction() {
64
+
65
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_catch' => 'functionCallbackCatch']);
66
+        $this->assertRegexp('/functionCallbackCatch\(err\)/', $r);
67
+    }
68
+
69
+    /**
70
+     * @test
71
+     */
72
+    public function testCustomValidationFunction() {
73
+
74
+        $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['custom_validation' => 'functionCustomValidation']);
75
+        $this->assertRegexp('/functionCustomValidation\(token\)/', $r);
76
+    }
77
+
78
+    /**
79
+     * @test
80
+     */
81
+    public function testValidateController() {
82
+
83
+        $controller = App::make(ReCaptchaController::class);
84
+        $return = $controller->validateV3();
85
+
86
+        $this->assertArrayHasKey("success", $return);
87
+        $this->assertArrayHasKey("error-codes", $return);
88
+    }
89
+
90
+    /**
91
+     * Define environment setup.
92
+     *
93
+     * @param  \Illuminate\Foundation\Application $app
94
+     *
95
+     * @return void
96
+     */
97
+    protected function getEnvironmentSetUp($app) {
98
+
99
+        $app['config']->set('recaptcha.version', 'v3');
100
+    }
101
+
102
+    /**
103
+     * Setup the test environment.
104
+     */
105
+    protected function setUp(): void {
106
+
107
+        parent::setUp(); // TODO: Change the autogenerated stub
108
+
109
+        $this->recaptcha_v3 = new ReCaptchaBuilderV3('api_site_key', 'api_secret_key');
110
+
111
+    }
112 112
 }
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
tests/ReCaptchaTest.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -20,73 +20,73 @@
 block discarded – undo
20 20
  */
21 21
 class ReCaptchaTest extends TestCase {
22 22
 
23
-	protected $recaptcha_invisible = null;
23
+    protected $recaptcha_invisible = null;
24 24
 
25
-	protected $recaptcha_v2        = null;
25
+    protected $recaptcha_v2        = null;
26 26
 
27
-	/**
28
-	 * @tests
29
-	 */
30
-	public function testHtmlScriptTagJsApiGetHtmlScriptTag() {
27
+    /**
28
+     * @tests
29
+     */
30
+    public function testHtmlScriptTagJsApiGetHtmlScriptTag() {
31 31
 
32
-		$r = ReCaptcha::htmlScriptTagJsApi();
33
-		$this->assertEquals('<script src="https://www.google.com/recaptcha/api.js" async defer></script>', $r);
34
-	}
32
+        $r = ReCaptcha::htmlScriptTagJsApi();
33
+        $this->assertEquals('<script src="https://www.google.com/recaptcha/api.js" async defer></script>', $r);
34
+    }
35 35
 
36
-	/**
37
-	 * @test
38
-	 */
39
-	public function testReCaptchaInvisibleHtmlFormButtonDefault() {
36
+    /**
37
+     * @test
38
+     */
39
+    public function testReCaptchaInvisibleHtmlFormButtonDefault() {
40 40
 
41
-		$recaptcha = $this->recaptcha_invisible;
42
-		$html_button = $recaptcha->htmlFormButton();
43
-		$this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button>', $html_button);
44
-	}
41
+        $recaptcha = $this->recaptcha_invisible;
42
+        $html_button = $recaptcha->htmlFormButton();
43
+        $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button>', $html_button);
44
+    }
45 45
 
46
-	/**
47
-	 * @test
48
-	 */
49
-	public function testReCaptchaInvisibleHtmlFormButtonCustom() {
46
+    /**
47
+     * @test
48
+     */
49
+    public function testReCaptchaInvisibleHtmlFormButtonCustom() {
50 50
 
51
-		$recaptcha = $this->recaptcha_invisible;
52
-		$html_button = $recaptcha->htmlFormButton('Custom Text');
53
-		$this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button>', $html_button);
54
-	}
51
+        $recaptcha = $this->recaptcha_invisible;
52
+        $html_button = $recaptcha->htmlFormButton('Custom Text');
53
+        $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button>', $html_button);
54
+    }
55 55
 
56
-	/**
57
-	 * @test
58
-	 */
59
-	public function testReCaptchaV2HtmlFormSnippet() {
56
+    /**
57
+     * @test
58
+     */
59
+    public function testReCaptchaV2HtmlFormSnippet() {
60 60
 
61
-		$recaptcha = $this->recaptcha_v2;
62
-		$html_snippet = $recaptcha->htmlFormSnippet();
63
-		$this->assertEquals('<div class="g-recaptcha" data-sitekey="api_site_key"></div>', $html_snippet);
64
-	}
61
+        $recaptcha = $this->recaptcha_v2;
62
+        $html_snippet = $recaptcha->htmlFormSnippet();
63
+        $this->assertEquals('<div class="g-recaptcha" data-sitekey="api_site_key"></div>', $html_snippet);
64
+    }
65 65
 
66
-	/**
67
-	 * @test
68
-	 * @expectedException     \Error
69
-	 */
70
-	public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError() {
66
+    /**
67
+     * @test
68
+     * @expectedException     \Error
69
+     */
70
+    public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError() {
71 71
 
72
-		$this->recaptcha_invisible->htmlFormSnippet();
73
-	}
72
+        $this->recaptcha_invisible->htmlFormSnippet();
73
+    }
74 74
 
75
-	/**
76
-	 * @test
77
-	 * @expectedException     \Error
78
-	 */
79
-	public function testReCaptchaV2htmlFormButtonShouldThrowError() {
75
+    /**
76
+     * @test
77
+     * @expectedException     \Error
78
+     */
79
+    public function testReCaptchaV2htmlFormButtonShouldThrowError() {
80 80
 
81
-		$this->recaptcha_v2->htmlFormButton();
82
-	}
81
+        $this->recaptcha_v2->htmlFormButton();
82
+    }
83 83
 
84
-	protected function setUp(): void {
84
+    protected function setUp(): void {
85 85
 
86
-		parent::setUp(); // TODO: Change the autogenerated stub
86
+        parent::setUp(); // TODO: Change the autogenerated stub
87 87
 
88
-		$this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key');
89
-		$this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
88
+        $this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key');
89
+        $this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
90 90
 
91
-	}
91
+    }
92 92
 }
93 93
\ No newline at end of file
Please login to merge, or discard this patch.