Completed
Push — master ( 396027...9efca8 )
by Владислав
04:08 queued 01:57
created
tests/DeCaptchaAbstractTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function testGetBaseUrl()
20 20
     {
21 21
         $abstract = $this->newInstance();
22
-        $getBaseUrlCaller = function () {
22
+        $getBaseUrlCaller = function() {
23 23
             $this->domain = 'domain';
24 24
 
25 25
             return $this->getBaseUrl();
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
     public function testGetFilePath()
53 53
     {
54 54
         $abstract = $this->newInstance();
55
-        $getFilePathCaller = function ($val) {
55
+        $getFilePathCaller = function($val) {
56 56
             return $this->getFilePath($val);
57 57
         };
58 58
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
59
-        $this->assertEquals(__DIR__.'/data/Captcha.jpg', $bound(__DIR__.'/data/Captcha.jpg'));
59
+        $this->assertEquals(__DIR__ . '/data/Captcha.jpg', $bound(__DIR__ . '/data/Captcha.jpg'));
60 60
         $filePathUpload = $bound('https://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg');
61
-        $file1 = file_get_contents(__DIR__.'/data/Captcha.jpg');
61
+        $file1 = file_get_contents(__DIR__ . '/data/Captcha.jpg');
62 62
         $file2 = file_get_contents($filePathUpload);
63 63
         $this->assertEquals($file1, $file2);
64 64
     }
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
     public function testGetFilePathErrorFileNotFound()
71 71
     {
72 72
         $abstract = $this->newInstance();
73
-        $getFilePathCaller = function ($val) {
73
+        $getFilePathCaller = function($val) {
74 74
             return $this->getFilePath($val);
75 75
         };
76 76
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
77
-        $bound(__DIR__.'/data/Captcha1.jpg');
77
+        $bound(__DIR__ . '/data/Captcha1.jpg');
78 78
     }
79 79
 
80 80
     /**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     public function testGetFilePathErrorFileIsNotLoaded()
86 86
     {
87 87
         $abstract = $this->newInstance();
88
-        $getFilePathCaller = function ($val) {
88
+        $getFilePathCaller = function($val) {
89 89
             return $this->getFilePath($val);
90 90
         };
91 91
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
Please login to merge, or discard this patch.
tests/TwoCaptchaTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         ]);
18 18
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
19 19
         $captcha->setCauseAnError(true);
20
-        $captcha->recognize(__DIR__.'/data/Captcha.jpg');
20
+        $captcha->recognize(__DIR__ . '/data/Captcha.jpg');
21 21
     }
22 22
 
23 23
     public function testRecognizeBalanceError2()
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
             \jumper423\decaptcha\services\TwoCaptcha::PARAM_SPEC_API_KEY => '200a1ed2b6ca001d8171c655658086ed',
27 27
         ]);
28 28
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
29
-        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
29
+        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
30 30
             $this->assertEquals('11111111111111', $captcha->getCode());
31 31
         } else {
32 32
             $this->assertEquals('Нулевой либо отрицательный баланс', $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
@@ -92,8 +92,7 @@  discard block
 block discarded – undo
92 92
         }
93 93
         $decodeSetting = $this->decodeSettings[static::DECODE_ACTION][$action];
94 94
         $decodeFormat = array_key_exists(static::DECODE_FORMAT, $decodeSetting) ?
95
-            $decodeSetting[static::DECODE_FORMAT] :
96
-            $this->decodeSettings[static::DECODE_FORMAT];
95
+            $decodeSetting[static::DECODE_FORMAT] : $this->decodeSettings[static::DECODE_FORMAT];
97 96
         $values = [];
98 97
         switch ($decodeFormat) {
99 98
             case static::RESPONSE_TYPE_STRING:
@@ -154,7 +153,7 @@  discard block
 block discarded – undo
154 153
      */
155 154
     protected function getActionUrl($action)
156 155
     {
157
-        return $this->getBaseUrl().$this->actions[$action][static::ACTION_URI];
156
+        return $this->getBaseUrl() . $this->actions[$action][static::ACTION_URI];
158 157
     }
159 158
 
160 159
     /**
@@ -198,13 +197,13 @@  discard block
 block discarded – undo
198 197
         }
199 198
         switch ($param) {
200 199
             case static::PARAM_SPEC_FILE:
201
-                return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->params[$param]) : '@'.$this->params[$param];
200
+                return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->params[$param]) : '@' . $this->params[$param];
202 201
             case static::PARAM_SPEC_API_KEY:
203 202
                 return is_callable($this->params[$param]) ? $this->params[$param]() : $this->params[$param];
204 203
             case static::PARAM_SPEC_CAPTCHA:
205
-                return (int)$this->params[$param];
204
+                return (int) $this->params[$param];
206 205
             case static::PARAM_SPEC_CODE:
207
-                return (string)$this->params[$param];
206
+                return (string) $this->params[$param];
208 207
         }
209 208
 
210 209
         return null;
@@ -305,7 +304,7 @@  discard block
 block discarded – undo
305 304
             foreach ($data as $key => $value) {
306 305
                 $uri[] = "$key=$value";
307 306
             }
308
-            $url .= '?'.implode('&', $uri);
307
+            $url .= '?' . implode('&', $uri);
309 308
         }
310 309
         curl_setopt($ch, CURLOPT_URL, $url);
311 310
         if (version_compare(PHP_VERSION, '5.5.0') >= 0 && version_compare(PHP_VERSION, '7.0') < 0 && defined('CURLOPT_SAFE_UPLOAD')) {
Please login to merge, or discard this patch.