Passed
Pull Request — master (#11)
by Roberto
05:19
created
src/ReCaptchaServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     {
21 21
         $this->addValidationRule();
22 22
         $this->publishes([
23
-            __DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'),
23
+            __DIR__.'/../config/recaptcha.php' => config_path('recaptcha.php'),
24 24
         ]);
25 25
     }
26 26
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     {
34 34
 
35 35
         $this->mergeConfigFrom(
36
-            __DIR__ . '/../config/recaptcha.php', 'recaptcha'
36
+            __DIR__.'/../config/recaptcha.php', 'recaptcha'
37 37
         );
38 38
 
39 39
         $this->registerReCaptchaBuilder();
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
      */
47 47
     protected function registerReCaptchaBuilder()
48 48
     {
49
-        $this->app->singleton('recaptcha', function ($app) {
50
-            if(config('recaptcha.version') == 'v2') return new ReCaptchaBuilderV2(config('recaptcha.api_site_key'), config('recaptcha.api_secret_key'), config('recaptcha.version'));
49
+        $this->app->singleton('recaptcha', function($app) {
50
+            if (config('recaptcha.version') == 'v2') return new ReCaptchaBuilderV2(config('recaptcha.api_site_key'), config('recaptcha.api_secret_key'), config('recaptcha.version'));
51 51
             else return new ReCaptchaBuilderInvisible(config('recaptcha.api_site_key'), config('recaptcha.api_secret_key'), config('recaptcha.version'));
52 52
         });
53 53
     }
Please login to merge, or discard this patch.
src/ReCaptchaBuilderInvisible.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function htmlFormButton($buttonInnerHTML = 'Submit')
21 21
 	{
22
-		return ($this->version == 'invisible')? '<button class="g-recaptcha" data-sitekey="'.$this->api_site_key.'" data-callback="biscolabLaravelReCaptcha">'.$buttonInnerHTML.'</button>' : '';
22
+		return ($this->version == 'invisible') ? '<button class="g-recaptcha" data-sitekey="'.$this->api_site_key.'" data-callback="biscolabLaravelReCaptcha">'.$buttonInnerHTML.'</button>' : '';
23 23
 	}
24 24
 
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/ReCaptchaBuilderV2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function htmlFormSnippet()
21 21
 	{
22
-		return ($this->version == 'v2')? '<div class="g-recaptcha" data-sitekey="'.$this->api_site_key.'"></div>' : '';
22
+		return ($this->version == 'v2') ? '<div class="g-recaptcha" data-sitekey="'.$this->api_site_key.'"></div>' : '';
23 23
 	}
24 24
 
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/ReCaptchaBuilder.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 
50 50
 	public function __construct($api_site_key, $api_secret_key, $version = 'v2')
51 51
 	{
52
-		$this->api_site_key		= $api_site_key;
53
-		$this->api_secret_key	= $api_secret_key;
54
-		$this->version 			= $version;
55
-		$this->skip_by_ip 		= self::skipByIp();
52
+		$this->api_site_key = $api_site_key;
53
+		$this->api_secret_key = $api_secret_key;
54
+		$this->version = $version;
55
+		$this->skip_by_ip = self::skipByIp();
56 56
 	}
57 57
 	
58 58
 	/**
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function htmlScriptTagJsApi($formId = '')
65 65
 	{
66
-		if($this->skip_by_ip) return '';
66
+		if ($this->skip_by_ip) return '';
67 67
 		$html = "<script src='https://www.google.com/recaptcha/api.js' async defer></script>";
68
-		if($this->version != 'v2'){
69
-			if(!$formId) throw new Exception("formId required", 1);
70
-			$html.= '<script>
68
+		if ($this->version != 'v2') {
69
+			if (!$formId) throw new Exception("formId required", 1);
70
+			$html .= '<script>
71 71
 		       function biscolabLaravelReCaptcha(token) {
72 72
 		         document.getElementById("'.$formId.'").submit();
73 73
 		       }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function validate($response)
87 87
     {
88
-    	if($this->skip_by_ip) {
88
+    	if ($this->skip_by_ip) {
89 89
     		return true;
90 90
     	} 
91 91
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             'response' => $response,
96 96
         ]);
97 97
 
98
-        $url = $this->api_url. '?' . $params;
98
+        $url = $this->api_url.'?'.$params;
99 99
 
100 100
         if (function_exists('curl_version')) {
101 101
             $curl = curl_init($url);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         } else {
108 108
             $curl_response = file_get_contents($url);
109 109
         }
110
-        if (is_null($curl_response) || empty( $curl_response )) {
110
+        if (is_null($curl_response) || empty($curl_response)) {
111 111
             return false;
112 112
         }
113 113
         $response = json_decode(trim($curl_response), true);
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
      *
121 121
      * @return boolean     
122 122
      */
123
-    public static function skipByIp(){
124
-    	$skip_ip = (config('recaptcha.skip_ip'))? config('recaptcha.skip_ip') : [];
123
+    public static function skipByIp() {
124
+    	$skip_ip = (config('recaptcha.skip_ip')) ? config('recaptcha.skip_ip') : [];
125 125
     	return (in_array(request()->ip(), $skip_ip));
126 126
     }
127 127
 }
128 128
\ No newline at end of file
Please login to merge, or discard this patch.
config/recaptcha.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      * get more info @ https://developers.google.com/recaptcha/docs/versions
38 38
      *
39 39
      */
40
-    'version'			=> 'v2'  ,
40
+    'version'			=> 'v2',
41 41
 
42 42
     /**
43 43
      *
Please login to merge, or discard this patch.