@@ -17,7 +17,7 @@ discard block |
||
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 |
||
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()); |
@@ -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); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function testExecutionDelayed() |
108 | 108 | { |
109 | 109 | $abstract = $this->newInstance(); |
110 | - $executionDelayedCaller = function ($second, $call = null) { |
|
110 | + $executionDelayedCaller = function($second, $call = null) { |
|
111 | 111 | return $this->executionDelayed($second, $call); |
112 | 112 | }; |
113 | 113 | $bound = $executionDelayedCaller->bindTo($abstract, $abstract); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $this->assertTrue(abs($timePassed - 0.1) < 0.035); |
119 | 119 | |
120 | 120 | $start = microtime(true); |
121 | - $bound(0.15, function () { |
|
121 | + $bound(0.15, function() { |
|
122 | 122 | sleep(0.2); |
123 | 123 | }); |
124 | 124 | $bound(0.1); |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | $this->assertTrue(abs($timePassed - 0.25) < 0.035); |
127 | 127 | |
128 | 128 | $start = microtime(true); |
129 | - $bound(0.15, function () { |
|
129 | + $bound(0.15, function() { |
|
130 | 130 | sleep(0.2); |
131 | 131 | }); |
132 | 132 | $bound(0.3); |
133 | 133 | $timePassed = microtime(true) - $start; |
134 | 134 | $this->assertTrue(abs($timePassed - 0.45) < 0.035); |
135 | 135 | |
136 | - $this->assertEquals(2, $bound(0, function () { |
|
136 | + $this->assertEquals(2, $bound(0, function() { |
|
137 | 137 | return 2; |
138 | 138 | })); |
139 | 139 | $this->assertEquals(null, $bound(0)); |
@@ -93,8 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | $decodeSetting = $this->decodeSettings[static::DECODE_ACTION][$action]; |
95 | 95 | $decodeFormat = array_key_exists(static::DECODE_FORMAT, $decodeSetting) ? |
96 | - $decodeSetting[static::DECODE_FORMAT] : |
|
97 | - $this->decodeSettings[static::DECODE_FORMAT]; |
|
96 | + $decodeSetting[static::DECODE_FORMAT] : $this->decodeSettings[static::DECODE_FORMAT]; |
|
98 | 97 | $values = []; |
99 | 98 | switch ($decodeFormat) { |
100 | 99 | case static::RESPONSE_TYPE_STRING: |
@@ -155,7 +154,7 @@ discard block |
||
155 | 154 | */ |
156 | 155 | protected function getActionUrl($action) |
157 | 156 | { |
158 | - return $this->getBaseUrl().$this->actions[$action][static::ACTION_URI]; |
|
157 | + return $this->getBaseUrl() . $this->actions[$action][static::ACTION_URI]; |
|
159 | 158 | } |
160 | 159 | |
161 | 160 | /** |
@@ -199,7 +198,7 @@ discard block |
||
199 | 198 | } |
200 | 199 | switch ($param) { |
201 | 200 | case static::PARAM_SPEC_FILE: |
202 | - return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@'.$this->getFilePath($this->params[$param]); |
|
201 | + return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@' . $this->getFilePath($this->params[$param]); |
|
203 | 202 | case static::PARAM_SPEC_API_KEY: |
204 | 203 | return is_callable($this->params[$param]) ? $this->params[$param]() : $this->params[$param]; |
205 | 204 | case static::PARAM_SPEC_CAPTCHA: |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | foreach ($data as $key => $value) { |
310 | 309 | $uri[] = "$key=$value"; |
311 | 310 | } |
312 | - $url .= '?'.implode('&', $uri); |
|
311 | + $url .= '?' . implode('&', $uri); |
|
313 | 312 | } |
314 | 313 | curl_setopt($ch, CURLOPT_URL, $url); |
315 | 314 | if (!$isJson && version_compare(PHP_VERSION, '5.5.0') >= 0 && version_compare(PHP_VERSION, '7.0') < 0 && defined('CURLOPT_SAFE_UPLOAD')) { |
@@ -327,7 +326,7 @@ discard block |
||
327 | 326 | curl_setopt($ch, CURLOPT_HTTPHEADER, [ |
328 | 327 | 'Content-Type: application/json; charset=utf-8', |
329 | 328 | 'Accept: application/json', |
330 | - 'Content-Length: '.strlen($data), |
|
329 | + 'Content-Length: ' . strlen($data), |
|
331 | 330 | ]); |
332 | 331 | } |
333 | 332 | $result = curl_exec($ch); |