Completed
Push — master ( ce7de3...7f2995 )
by Владислав
04:45 queued 02:20
created
tests/AnticaptchaTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
             \jumper423\decaptcha\services\Anticaptcha::PARAM_SPEC_API_KEY => '5464654645646',
12 12
         ]);
13 13
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
14
-        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
14
+        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
15 15
             $this->assertEquals('11111111111111', $captcha->getCode());
16 16
         } else {
17 17
             $this->assertEquals('Использован несуществующий key', $captcha->getError());
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_LANGUAGE => 'ru',
26 26
         ]);
27 27
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
28
-        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
28
+        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
29 29
             $this->assertEquals('11111111111111', $captcha->getCode());
30 30
         } else {
31 31
             $this->assertEquals('Нет в допустимых значиниях поля: languagePool = ru', $captcha->getError());
Please login to merge, or discard this patch.
src/core/DeCaptchaAbstract.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
         $decodeSetting = $this->decodeSettings[static::DECODE_ACTION][$action];
103 103
         $decodeFormat = array_key_exists(static::DECODE_FORMAT, $decodeSetting) ?
104
-            $decodeSetting[static::DECODE_FORMAT] :
105
-            $this->decodeSettings[static::DECODE_FORMAT];
104
+            $decodeSetting[static::DECODE_FORMAT] : $this->decodeSettings[static::DECODE_FORMAT];
106 105
         $values = [];
107 106
         switch ($decodeFormat) {
108 107
             case static::RESPONSE_TYPE_STRING:
@@ -179,7 +178,7 @@  discard block
 block discarded – undo
179 178
      */
180 179
     protected function getActionUrl($action)
181 180
     {
182
-        return $this->getBaseUrl().$this->actions[$action][static::ACTION_URI];
181
+        return $this->getBaseUrl() . $this->actions[$action][static::ACTION_URI];
183 182
     }
184 183
 
185 184
     /**
@@ -229,7 +228,7 @@  discard block
 block discarded – undo
229 228
                         return base64_encode(file_get_contents($this->params[$param]));
230 229
                 }
231 230
 
232
-                return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@'.$this->getFilePath($this->params[$param]);
231
+                return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@' . $this->getFilePath($this->params[$param]);
233 232
             case static::PARAM_SPEC_API_KEY:
234 233
                 return is_callable($this->params[$param]) ? $this->params[$param]() : $this->params[$param];
235 234
             case static::PARAM_SPEC_CAPTCHA:
@@ -296,7 +295,7 @@  discard block
 block discarded – undo
296 295
                         break;
297 296
                 }
298 297
                 if (array_key_exists(self::PARAM_SLUG_ENUM, $settings) && !in_array($value, $settings[static::PARAM_SLUG_ENUM])) {
299
-                    throw new DeCaptchaErrors(DeCaptchaErrors::ERROR_PARAM_ENUM, (array_key_exists($field, $this->paramsNames) ? $this->paramsNames[$field] : $field).' = '.$value, $this->errorLang);
298
+                    throw new DeCaptchaErrors(DeCaptchaErrors::ERROR_PARAM_ENUM, (array_key_exists($field, $this->paramsNames) ? $this->paramsNames[$field] : $field) . ' = ' . $value, $this->errorLang);
300 299
                 }
301 300
                 $params[$this->paramsNames[$field]] = $value;
302 301
             }
@@ -360,7 +359,7 @@  discard block
 block discarded – undo
360 359
             foreach ($data as $key => $value) {
361 360
                 $uri[] = "$key=$value";
362 361
             }
363
-            $url .= '?'.implode('&', $uri);
362
+            $url .= '?' . implode('&', $uri);
364 363
         }
365 364
         curl_setopt($ch, CURLOPT_URL, $url);
366 365
         if (!$isJson && version_compare(PHP_VERSION, '5.5.0') >= 0 && version_compare(PHP_VERSION, '7.0') < 0 && defined('CURLOPT_SAFE_UPLOAD')) {
@@ -378,7 +377,7 @@  discard block
 block discarded – undo
378 377
             curl_setopt($ch, CURLOPT_HTTPHEADER, [
379 378
                 'Content-Type: application/json; charset=utf-8',
380 379
                 'Accept: application/json',
381
-                'Content-Length: '.strlen($data),
380
+                'Content-Length: ' . strlen($data),
382 381
             ]);
383 382
         }
384 383
         $result = curl_exec($ch);
Please login to merge, or discard this patch.