Passed
Push — master ( 47c941...a9f564 )
by Roberto
09:10 queued 11s
created
tests/TestCase.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,31 +21,31 @@
 block discarded – undo
21 21
 class TestCase extends OrchestraTestCase
22 22
 {
23 23
 
24
-	/**
25
-	 * Load package alias
26
-	 *
27
-	 * @param  \Illuminate\Foundation\Application $app
28
-	 *
29
-	 * @return array
30
-	 */
31
-	protected function getPackageAliases($app)
32
-	{
24
+    /**
25
+     * Load package alias
26
+     *
27
+     * @param  \Illuminate\Foundation\Application $app
28
+     *
29
+     * @return array
30
+     */
31
+    protected function getPackageAliases($app)
32
+    {
33 33
 
34
-		return [
35
-			'ReCaptcha' => ReCaptcha::class,
36
-		];
37
-	}
34
+        return [
35
+            'ReCaptcha' => ReCaptcha::class,
36
+        ];
37
+    }
38 38
 
39
-	/**
40
-	 * Load package service provider
41
-	 *
42
-	 * @param \Illuminate\Foundation\Application $app
43
-	 *
44
-	 * @return array
45
-	 */
46
-	protected function getPackageProviders($app)
47
-	{
39
+    /**
40
+     * Load package service provider
41
+     *
42
+     * @param \Illuminate\Foundation\Application $app
43
+     *
44
+     * @return array
45
+     */
46
+    protected function getPackageProviders($app)
47
+    {
48 48
 
49
-		return [ReCaptchaServiceProvider::class];
50
-	}
49
+        return [ReCaptchaServiceProvider::class];
50
+    }
51 51
 }
Please login to merge, or discard this patch.
src/Controllers/ReCaptchaController.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 block discarded – undo
19 19
 class ReCaptchaController extends Controller
20 20
 {
21 21
 
22
-	/**
23
-	 * @return array
24
-	 */
25
-	public function validateV3(): array
26
-	{
22
+    /**
23
+     * @return array
24
+     */
25
+    public function validateV3(): array
26
+    {
27 27
 
28
-		$token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), '');
28
+        $token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), '');
29 29
 
30
-		return recaptcha()->validate($token);
31
-	}
30
+        return recaptcha()->validate($token);
31
+    }
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
tests/ReCaptchaConfigurationTest.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -20,72 +20,72 @@
 block discarded – undo
20 20
 class ReCaptchaConfigurationTest extends TestCase
21 21
 {
22 22
 
23
-	/**
24
-	 * @var ReCaptchaBuilder
25
-	 */
26
-	protected $recaptcha;
27
-
28
-	/**
29
-	 * @test
30
-	 */
31
-	public function testGetApiSiteKey() {
32
-		$this->assertEquals("api_site_key", $this->recaptcha->getApiSiteKey());
33
-	}
34
-
35
-	/**
36
-	 * @test
37
-	 */
38
-	public function testGetApiSecretKey() {
39
-		$this->assertEquals("api_secret_key", $this->recaptcha->getApiSecretKey());
40
-	}
41
-
42
-	/**
43
-	 * @test
44
-	 */
45
-	public function testSkipIpWhiteListIsArray()
46
-	{
47
-
48
-		$ip_whitelist = $this->recaptcha->getIpWhitelist();
49
-		$this->assertTrue(is_array($ip_whitelist));
50
-		$this->assertCount(2, $ip_whitelist);
51
-
52
-		$this->assertEquals('10.0.0.1', $ip_whitelist[0]);
53
-		$this->assertEquals('10.0.0.2', $ip_whitelist[1]);
54
-	}
55
-
56
-	/**
57
-	 * @test
58
-	 */
59
-	public function testCurlTimeoutIsSet()
60
-	{
61
-
62
-		$this->assertEquals(3, $this->recaptcha->getCurlTimeout());
63
-	}
64
-
65
-	/**
66
-	 * Define environment setup.
67
-	 *
68
-	 * @param  \Illuminate\Foundation\Application $app
69
-	 *
70
-	 * @return void
71
-	 */
72
-	protected function getEnvironmentSetUp($app)
73
-	{
74
-
75
-		$app['config']->set('recaptcha.api_site_key', 'api_site_key');
76
-		$app['config']->set('recaptcha.api_secret_key', 'api_secret_key');
77
-		$app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2');
78
-		$app['config']->set('recaptcha.curl_timeout', 3);
79
-	}
80
-
81
-	/**
82
-	 * Setup the test environment.
83
-	 */
84
-	protected function setUp(): void
85
-	{
86
-
87
-		parent::setUp(); // TODO: Change the autogenerated stub
88
-
89
-		$this->recaptcha = recaptcha();
90
-	}
23
+    /**
24
+     * @var ReCaptchaBuilder
25
+     */
26
+    protected $recaptcha;
27
+
28
+    /**
29
+     * @test
30
+     */
31
+    public function testGetApiSiteKey() {
32
+        $this->assertEquals("api_site_key", $this->recaptcha->getApiSiteKey());
33
+    }
34
+
35
+    /**
36
+     * @test
37
+     */
38
+    public function testGetApiSecretKey() {
39
+        $this->assertEquals("api_secret_key", $this->recaptcha->getApiSecretKey());
40
+    }
41
+
42
+    /**
43
+     * @test
44
+     */
45
+    public function testSkipIpWhiteListIsArray()
46
+    {
47
+
48
+        $ip_whitelist = $this->recaptcha->getIpWhitelist();
49
+        $this->assertTrue(is_array($ip_whitelist));
50
+        $this->assertCount(2, $ip_whitelist);
51
+
52
+        $this->assertEquals('10.0.0.1', $ip_whitelist[0]);
53
+        $this->assertEquals('10.0.0.2', $ip_whitelist[1]);
54
+    }
55
+
56
+    /**
57
+     * @test
58
+     */
59
+    public function testCurlTimeoutIsSet()
60
+    {
61
+
62
+        $this->assertEquals(3, $this->recaptcha->getCurlTimeout());
63
+    }
64
+
65
+    /**
66
+     * Define environment setup.
67
+     *
68
+     * @param  \Illuminate\Foundation\Application $app
69
+     *
70
+     * @return void
71
+     */
72
+    protected function getEnvironmentSetUp($app)
73
+    {
74
+
75
+        $app['config']->set('recaptcha.api_site_key', 'api_site_key');
76
+        $app['config']->set('recaptcha.api_secret_key', 'api_secret_key');
77
+        $app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2');
78
+        $app['config']->set('recaptcha.curl_timeout', 3);
79
+    }
80
+
81
+    /**
82
+     * Setup the test environment.
83
+     */
84
+    protected function setUp(): void
85
+    {
86
+
87
+        parent::setUp(); // TODO: Change the autogenerated stub
88
+
89
+        $this->recaptcha = recaptcha();
90
+    }
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
src/ReCaptchaServiceProvider.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         Validator::extendImplicit(recaptchaRuleName(), function ($attribute, $value) {
52 52
 
53 53
             return app('recaptcha')->validate($value);
54
-		}, trans('validation.recaptcha'));
54
+        }, trans('validation.recaptcha'));
55 55
     }
56 56
 
57 57
     /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $this->addValidationRule();
38 38
         $this->registerRoutes();
39 39
         $this->publishes([
40
-            __DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'),
40
+            __DIR__.'/../config/recaptcha.php' => config_path('recaptcha.php'),
41 41
         ], 'config');
42 42
 
43 43
     }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     public function addValidationRule()
49 49
     {
50 50
 
51
-        Validator::extendImplicit(recaptchaRuleName(), function ($attribute, $value) {
51
+        Validator::extendImplicit(recaptchaRuleName(), function($attribute, $value) {
52 52
 
53 53
             return app('recaptcha')->validate($value);
54 54
 		}, trans('validation.recaptcha'));
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
 
65 65
         $this->mergeConfigFrom(
66
-            __DIR__ . '/../config/recaptcha.php', 'recaptcha'
66
+            __DIR__.'/../config/recaptcha.php', 'recaptcha'
67 67
         );
68 68
 
69 69
         $this->registerReCaptchaBuilder();
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     protected function registerReCaptchaBuilder()
105 105
     {
106 106
 
107
-        $this->app->singleton('recaptcha', function ($app) {
107
+        $this->app->singleton('recaptcha', function($app) {
108 108
 
109 109
             $recaptcha_class = '';
110 110
 
Please login to merge, or discard this patch.
src/ReCaptchaBuilderInvisible.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 //                    http_build_query($properties, null, '" ', PHP_QUERY_RFC3986)) . '"';
70 70
             $temp_properties = [];
71 71
             foreach ($properties as $k => $v) {
72
-                $temp_properties[] = $k . '="' . $v . '"';
72
+                $temp_properties[] = $k.'="'.$v.'"';
73 73
             }
74 74
 
75 75
             $tag_properties = implode(" ", $temp_properties);
76 76
         }
77 77
 
78
-        return ($this->version == 'invisible') ? '<button ' . $tag_properties . '>' . $button_label . '</button>' : '';
78
+        return ($this->version == 'invisible') ? '<button '.$tag_properties.'>'.$button_label.'</button>' : '';
79 79
     }
80 80
 
81 81
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         }
101 101
         $html .= '<script>
102 102
 		       function biscolabLaravelReCaptcha(token) {
103
-		         document.getElementById("' . $form_id . '").submit();
103
+		         document.getElementById("' . $form_id.'").submit();
104 104
 		       }
105 105
 		     </script>';
106 106
 
Please login to merge, or discard this patch.
tests/ReCaptchaLangTest.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -17,59 +17,59 @@
 block discarded – undo
17 17
 class ReCaptchaLangTest extends TestCase
18 18
 {
19 19
 
20
-	/**
21
-	 * @var ReCaptchaBuilderInvisible
22
-	 */
23
-	protected $recaptcha_invisible;
20
+    /**
21
+     * @var ReCaptchaBuilderInvisible
22
+     */
23
+    protected $recaptcha_invisible;
24 24
 
25
-	/**
26
-	 * @var ReCaptchaBuilderV2
27
-	 */
28
-	protected $recaptcha_v2;
25
+    /**
26
+     * @var ReCaptchaBuilderV2
27
+     */
28
+    protected $recaptcha_v2;
29 29
 
30
-	/**
31
-	 * @tests
32
-	 */
33
-	public function testHtmlScriptTagJsApiGetHtmlScriptWithHlParam()
34
-	{
30
+    /**
31
+     * @tests
32
+     */
33
+    public function testHtmlScriptTagJsApiGetHtmlScriptWithHlParam()
34
+    {
35 35
 
36
-		$r = ReCaptcha::htmlScriptTagJsApi();
37
-		$this->assertEquals('<script src="https://www.google.com/recaptcha/api.js?hl=it" async defer></script>', $r);
38
-	}
36
+        $r = ReCaptcha::htmlScriptTagJsApi();
37
+        $this->assertEquals('<script src="https://www.google.com/recaptcha/api.js?hl=it" async defer></script>', $r);
38
+    }
39 39
 
40
-	/**
41
-	 * @tests
42
-	 */
43
-	public function testHtmlScriptTagJsApiGetHtmlScriptOverridingHlParam()
44
-	{
40
+    /**
41
+     * @tests
42
+     */
43
+    public function testHtmlScriptTagJsApiGetHtmlScriptOverridingHlParam()
44
+    {
45 45
 
46
-		$r = ReCaptcha::htmlScriptTagJsApi(['lang' => 'en']);
47
-		$this->assertEquals('<script src="https://www.google.com/recaptcha/api.js?hl=en" async defer></script>', $r);
48
-	}
46
+        $r = ReCaptcha::htmlScriptTagJsApi(['lang' => 'en']);
47
+        $this->assertEquals('<script src="https://www.google.com/recaptcha/api.js?hl=en" async defer></script>', $r);
48
+    }
49 49
 
50
-	/**
51
-	 * Define environment setup.
52
-	 *
53
-	 * @param  \Illuminate\Foundation\Application $app
54
-	 *
55
-	 * @return void
56
-	 */
57
-	protected function getEnvironmentSetUp($app)
58
-	{
50
+    /**
51
+     * Define environment setup.
52
+     *
53
+     * @param  \Illuminate\Foundation\Application $app
54
+     *
55
+     * @return void
56
+     */
57
+    protected function getEnvironmentSetUp($app)
58
+    {
59 59
 
60
-		$app['config']->set('recaptcha.default_language', 'it');
61
-	}
60
+        $app['config']->set('recaptcha.default_language', 'it');
61
+    }
62 62
 
63
-	/**
64
-	 * Setup the test environment.
65
-	 */
66
-	protected function setUp(): void
67
-	{
63
+    /**
64
+     * Setup the test environment.
65
+     */
66
+    protected function setUp(): void
67
+    {
68 68
 
69
-		parent::setUp(); // TODO: Change the autogenerated stub
69
+        parent::setUp(); // TODO: Change the autogenerated stub
70 70
 
71
-		$this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key');
72
-		$this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
71
+        $this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key');
72
+        $this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key');
73 73
 
74
-	}
74
+    }
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
src/ReCaptchaBuilder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
     public function setApiUrls(): ReCaptchaBuilder
215 215
     {
216 216
 
217
-        $this->api_url = 'https://' . $this->api_domain . '/recaptcha/api/siteverify';
218
-        $this->api_js_url = 'https://' . $this->api_domain . '/recaptcha/api.js';
217
+        $this->api_url = 'https://'.$this->api_domain.'/recaptcha/api/siteverify';
218
+        $this->api_js_url = 'https://'.$this->api_domain.'/recaptcha/api.js';
219 219
 
220 220
         return $this;
221 221
     }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $whitelist = explode(',', $whitelist);
233 233
         }
234 234
 
235
-        $whitelist = array_map(function ($item) {
235
+        $whitelist = array_map(function($item) {
236 236
 
237 237
             return trim($item);
238 238
         }, $whitelist);
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
         }
288 288
 
289 289
         // Create query string
290
-        $query = ($query) ? '?' . http_build_query($query) : "";
291
-        $html .= "<script src=\"" . $this->api_js_url .  $query . "\" async defer></script>";
290
+        $query = ($query) ? '?'.http_build_query($query) : "";
291
+        $html .= "<script src=\"".$this->api_js_url.$query."\" async defer></script>";
292 292
 
293 293
         return $html;
294 294
     }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             'response' => $response,
323 323
         ]);
324 324
 
325
-        $url = $this->api_url . '?' . $params;
325
+        $url = $this->api_url.'?'.$params;
326 326
 
327 327
         if (function_exists('curl_version')) {
328 328
 
Please login to merge, or discard this patch.
src/ReCaptchaBuilderV3.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             return '';
48 48
         }
49 49
 
50
-        $html = "<script src=\"" . $this->api_js_url . "?render={$this->api_site_key}\"></script>";
50
+        $html = "<script src=\"".$this->api_js_url."?render={$this->api_site_key}\"></script>";
51 51
 
52 52
         $action = Arr::get($configuration, 'action', 'homepage');
53 53
 
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
                 fetch('/" . config(
70 70
                 'recaptcha.default_validation_route',
71 71
                 'biscolab-recaptcha/validate'
72
-            ) . "?" . config(
72
+            )."?".config(
73 73
                 'recaptcha.default_token_parameter_name',
74 74
                 'token'
75
-            ) . "=' + token, {
75
+            )."=' + token, {
76 76
                     headers: {
77 77
                         \"X-Requested-With\": \"XMLHttpRequest\",
78 78
                         \"X-CSRF-TOKEN\": csrfToken.content
Please login to merge, or discard this patch.
src/ReCaptchaBuilderV2.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
         ksort($config_data_attributes);
58 58
         foreach ($config_data_attributes as $k => $v) {
59 59
             if ($v) {
60
-                $data_attributes[] = 'data-' . $k . '="' . $v . '"';
60
+                $data_attributes[] = 'data-'.$k.'="'.$v.'"';
61 61
             }
62 62
         }
63 63
 
64
-        $html = '<div class="g-recaptcha" ' . implode(" ", $data_attributes) . ' id="recaptcha-element"></div>';
64
+        $html = '<div class="g-recaptcha" '.implode(" ", $data_attributes).' id="recaptcha-element"></div>';
65 65
 
66 66
         return $html;
67 67
     }
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
         $tag_attributes = array_merge($tag_attributes, config('recaptcha.tag_attributes', []));
81 81
 
82 82
         if (Arr::get($tag_attributes, 'callback') === ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION) {
83
-            throw new InvalidConfigurationException('Property "callback" ("data-callback") must be different from "' . ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION . '"');
83
+            throw new InvalidConfigurationException('Property "callback" ("data-callback") must be different from "'.ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION.'"');
84 84
         }
85 85
 
86 86
         if (Arr::get($tag_attributes, 'expired-callback') === ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION) {
87
-            throw new InvalidConfigurationException('Property "expired-callback" ("data-expired-callback") must be different from "' . ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION . '"');
87
+            throw new InvalidConfigurationException('Property "expired-callback" ("data-expired-callback") must be different from "'.ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION.'"');
88 88
         }
89 89
 
90 90
         if (Arr::get($tag_attributes, 'error-callback') === ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION) {
91
-            throw new InvalidConfigurationException('Property "error-callback" ("data-error-callback") must be different from "' . ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION . '"');
91
+            throw new InvalidConfigurationException('Property "error-callback" ("data-error-callback") must be different from "'.ReCaptchaBuilder::DEFAULT_ONLOAD_JS_FUNCTION.'"');
92 92
         }
93 93
 
94 94
         return $tag_attributes;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $attributes = $this->getTagAttributes();
104 104
 
105
-        return "<script>var biscolabOnloadCallback = function() {grecaptcha.render('recaptcha-element', " . json_encode($attributes) . ");};</script>";
105
+        return "<script>var biscolabOnloadCallback = function() {grecaptcha.render('recaptcha-element', ".json_encode($attributes).");};</script>";
106 106
     }
107 107
 
108 108
     /**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public static function cleanAttributes(?array $attributes = []): array
115 115
     {
116
-        return array_filter($attributes, function ($k) {
116
+        return array_filter($attributes, function($k) {
117 117
             return in_array($k, self::$allowed_data_attribute);
118 118
         }, ARRAY_FILTER_USE_KEY);
119 119
     }
Please login to merge, or discard this patch.