Passed
Pull Request — master (#135)
by
unknown
03:34
created
src/Libraries/Validation/Rules/General.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
     {
73 73
         if (!empty($value)) {
74 74
             $captcha = CaptchaManager::getCaptcha();
75
-            if (!$captcha->verifyResponse($value)){
75
+            if (!$captcha->verifyResponse($value)) {
76 76
                 $this->addError($field, 'captcha', $param);
77 77
             }
78 78
         }
Please login to merge, or discard this patch.
src/Libraries/Captcha/CaptchaManager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
         if (!in_array($captchaAdapter, self::ADAPTERS) && !is_null($captchaAdapter)) {
30 30
             throw CaptchaException::cantConnect($captchaAdapter);
31
-        }elseif (is_null($captchaAdapter)){
31
+        }elseif (is_null($captchaAdapter)) {
32 32
             throw new \Exception('');
33 33
         }
34 34
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
         if (!in_array($captchaAdapter, self::ADAPTERS) && !is_null($captchaAdapter)) {
30 30
             throw CaptchaException::cantConnect($captchaAdapter);
31
-        }elseif (is_null($captchaAdapter)){
31
+        } elseif (is_null($captchaAdapter)){
32 32
             throw new \Exception('');
33 33
         }
34 34
 
Please login to merge, or discard this patch.
src/Libraries/Captcha/Adapters/HcaptchaAdapter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     public function display(string $formIdentifier = '', array $attributes = []): string
76 76
     {
77 77
         $captchaElement = '';
78
-        if (strtolower($this->type) == 'visible'){
78
+        if (strtolower($this->type) == 'visible') {
79 79
             $captchaElement = $this->getVisibleElement($attributes);
80 80
         } elseif (strtolower($this->type) == 'invisible') {
81 81
             $captchaElement = $this->getInvisibleElement($formIdentifier);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     {
173 173
         $this->http->createRequest(static::VERIFY_URL)->setMethod('POST')->setData($query)->start();
174 174
 
175
-        return (array)$this->http->getResponseBody();
175
+        return (array) $this->http->getResponseBody();
176 176
     }
177 177
 
178 178
     /**
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
                         let button = document.getElementsByTagName("button");
221 221
                     
222 222
                         button[0].setAttribute("data-sitekey", "' . $this->sitekey . '");
223
-                        button[0].setAttribute("data-callback", "'. $functionName .'");
223
+                        button[0].setAttribute("data-callback", "'. $functionName . '");
224 224
                         button[0].classList.add("h-captcha");
225 225
                      })
226 226
                     
227
-                    function '. $functionName .'(){
228
-                        document.getElementById("'. $formIdentifier .'").submit();
227
+                    function '. $functionName . '(){
228
+                        document.getElementById("'. $formIdentifier . '").submit();
229 229
                     }
230 230
                 </script>';
231 231
     }
Please login to merge, or discard this patch.
src/Libraries/Captcha/Adapters/RecaptchaAdapter.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public function renderJs($lang = null, $callback = false, $onLoadClass = 'onloadCallBack'): string
123 123
     {
124
-        return '<script src="'. self::CLIENT_API .'"></script>';
124
+        return '<script src="' . self::CLIENT_API . '"></script>';
125 125
     }
126 126
 
127 127
     /**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     public function display(string $formIdentifier = '', array $attributes = []): string
135 135
     {
136 136
         $captchaElement = '';
137
-        if (strtolower($this->type) == 'visible'){
137
+        if (strtolower($this->type) == 'visible') {
138 138
             $captchaElement = $this->getVisibleElement();
139 139
         } elseif (strtolower($this->type) == 'invisible') {
140 140
             $captchaElement = $this->getInvisibleElement($formIdentifier);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $url = self::VERIFY_URL . '?' . http_build_query($query);
170 170
 
171 171
         $this->http->createRequest($url)->setMethod('GET')->start();
172
-        $response = (array)$this->http->getResponseBody();
172
+        $response = (array) $this->http->getResponseBody();
173 173
 
174 174
         if (empty($response) || is_null($response) || !$response) {
175 175
             return false;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                  })
269 269
                 
270 270
                 function onSubmit (){
271
-                    document.getElementById("'. $formIdentifier .'").submit();
271
+                    document.getElementById("'. $formIdentifier . '").submit();
272 272
                 }
273 273
             </script>';
274 274
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,8 +150,9 @@
 block discarded – undo
150 150
      */
151 151
     public function verifyResponse(string $response, $clientIp = null): bool
152 152
     {
153
-        if (is_null($this->secretkey))
154
-            throw new \Exception('You must set your secret key');
153
+        if (is_null($this->secretkey)) {
154
+                    throw new \Exception('You must set your secret key');
155
+        }
155 156
 
156 157
         if (empty($response)) {
157 158
 
Please login to merge, or discard this patch.