@@ -96,8 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | $decodeSetting = $this->decodeSettings[static::DECODE_ACTION][$action]; |
98 | 98 | $decodeFormat = array_key_exists(static::DECODE_FORMAT, $decodeSetting) ? |
99 | - $decodeSetting[static::DECODE_FORMAT] : |
|
100 | - $this->decodeSettings[static::DECODE_FORMAT]; |
|
99 | + $decodeSetting[static::DECODE_FORMAT] : $this->decodeSettings[static::DECODE_FORMAT]; |
|
101 | 100 | $values = []; |
102 | 101 | switch ($decodeFormat) { |
103 | 102 | case static::RESPONSE_TYPE_STRING: |
@@ -158,7 +157,7 @@ discard block |
||
158 | 157 | */ |
159 | 158 | protected function getActionUrl($action) |
160 | 159 | { |
161 | - return $this->getBaseUrl().$this->actions[$action][static::ACTION_URI]; |
|
160 | + return $this->getBaseUrl() . $this->actions[$action][static::ACTION_URI]; |
|
162 | 161 | } |
163 | 162 | |
164 | 163 | /** |
@@ -201,7 +200,7 @@ discard block |
||
201 | 200 | } |
202 | 201 | switch ($param) { |
203 | 202 | case static::PARAM_SPEC_FILE: |
204 | - return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->params[$param]) : '@'.$this->params[$param]; |
|
203 | + return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->params[$param]) : '@' . $this->params[$param]; |
|
205 | 204 | case static::PARAM_SPEC_KEY: |
206 | 205 | return is_callable($this->params[$param]) ? $this->params[$param]() : $this->params[$param]; |
207 | 206 | case static::PARAM_SPEC_CAPTCHA: |
@@ -301,7 +300,7 @@ discard block |
||
301 | 300 | foreach ($data as $key => $value) { |
302 | 301 | $uri[] = "$key=$value"; |
303 | 302 | } |
304 | - $url .= '?'.implode('&', $uri); |
|
303 | + $url .= '?' . implode('&', $uri); |
|
305 | 304 | } |
306 | 305 | curl_setopt($ch, CURLOPT_URL, $url); |
307 | 306 | if (version_compare(PHP_VERSION, '5.5.0') >= 0 && version_compare(PHP_VERSION, '7.0') < 0 && defined('CURLOPT_SAFE_UPLOAD')) { |
@@ -19,7 +19,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -10,19 +10,19 @@ |
||
10 | 10 | $re = new \jumper423\decaptcha\services\TwoCaptcha([ |
11 | 11 | \jumper423\decaptcha\services\TwoCaptcha::PARAM_SPEC_API_KEY => 'b7e7f1002f0f917ca5a852e1c0312e8f', |
12 | 12 | ]); |
13 | - if ($re->recognize(__DIR__.'/data/Captcha.jpg')) { |
|
13 | + if ($re->recognize(__DIR__ . '/data/Captcha.jpg')) { |
|
14 | 14 | $this->assertEquals('11111111111111', $re->getCode()); |
15 | 15 | } else { |
16 | 16 | $this->assertEquals('22222222222222', $re->getError()); |
17 | 17 | } |
18 | 18 | |
19 | - $post_data_1 = [ 'file' => new CURLFile('file.txt') ]; |
|
19 | + $post_data_1 = ['file' => new CURLFile('file.txt')]; |
|
20 | 20 | $curl_1 = curl_init(); |
21 | 21 | curl_setopt($curl_1, CURLOPT_POSTFIELDS, $post_data_1); |
22 | 22 | echo "OK\n"; |
23 | 23 | |
24 | 24 | // exactly the same as above + added a reference to 'file' element |
25 | - $post_data_2 = [ 'file' => new CURLFile('file.txt') ]; |
|
25 | + $post_data_2 = ['file' => new CURLFile('file.txt')]; |
|
26 | 26 | $ref = & $post_data_2['file']; // *** |
27 | 27 | $curl_2 = curl_init(); |
28 | 28 | curl_setopt($curl_2, CURLOPT_POSTFIELDS, $post_data_2); |