Completed
Push — master ( 81d234...93238b )
by Владислав
03:31 queued 01:17
created
src/services/Rucaptcha.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@
 block discarded – undo
57 57
                     sleep($this->requestTimeout);
58 58
                 } else {
59 59
                     $ex = explode('|', $result);
60
-                    if (trim($ex[ 0 ]) == 'OK') {
61
-                        $this->result = trim($ex[ 1 ]);
60
+                    if (trim($ex[0]) == 'OK') {
61
+                        $this->result = trim($ex[1]);
62 62
 
63 63
                         return true;
64 64
                     }
Please login to merge, or discard this patch.
src/core/DeCaptchaBase.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@
 block discarded – undo
57 57
                     sleep($this->requestTimeout);
58 58
                 } else {
59 59
                     $ex = explode('|', $result);
60
-                    if (trim($ex[ 0 ]) == 'OK') {
61
-                        $this->result = trim($ex[ 1 ]);
60
+                    if (trim($ex[0]) == 'OK') {
61
+                        $this->result = trim($ex[1]);
62 62
 
63 63
                         return true;
64 64
                     }
Please login to merge, or discard this patch.
tests/DeCaptchaAbstractTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     /**
6 6
      * @return PHPUnit_Framework_MockObject_MockObject|\jumper423\decaptcha\core\DeCaptchaAbstract
7 7
      */
8
-    public function newInstance(){
8
+    public function newInstance() {
9 9
         $abstract = $this->getMockForAbstractClass(\jumper423\decaptcha\core\DeCaptchaAbstract::class);
10 10
         $abstract->errorLang = \jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU;
11 11
         return $abstract;
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     public function testGetBaseUrl()
15 15
     {
16 16
         $abstract = $this->newInstance();
17
-        $getBaseUrlCaller = function () {
17
+        $getBaseUrlCaller = function() {
18 18
             return $this->getBaseUrl();
19 19
         };
20 20
         $abstract->domain = 'domain';
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $abstract = $this->newInstance();
28 28
         $abstract->setApiKey('123456val');
29
-        $apiKeyValCaller = function () {
29
+        $apiKeyValCaller = function() {
30 30
             return $this->apiKey;
31 31
         };
32 32
         $bound = $apiKeyValCaller->bindTo($abstract, $abstract);
33 33
         $this->assertEquals('123456val', $bound());
34 34
 
35
-        $abstract->setApiKey(function () {
35
+        $abstract->setApiKey(function() {
36 36
             return '123456' . 'fun';
37 37
         });
38
-        $apiKeyFunCaller = function () {
38
+        $apiKeyFunCaller = function() {
39 39
             return $this->apiKey;
40 40
         };
41 41
         $bound = $apiKeyFunCaller->bindTo($abstract, $abstract);
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
     public function testGetActionUrl()
46 46
     {
47 47
         $abstract = $this->newInstance();
48
-        $getBaseUrlGetCodeCaller = function () {
48
+        $getBaseUrlGetCodeCaller = function() {
49 49
             $this->captchaId = 123;
50 50
             return $this->getActionUrl('get_code');
51 51
         };
52
-        $getBaseUrlGetBalanceCaller = function () {
52
+        $getBaseUrlGetBalanceCaller = function() {
53 53
             $this->captchaId = 234;
54 54
             return $this->getActionUrl('get_balance');
55 55
         };
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public function testGetFilePath()
65 65
     {
66 66
         $abstract = $this->newInstance();
67
-        $getFilePathCaller = function ($val) {
67
+        $getFilePathCaller = function($val) {
68 68
             return $this->getFilePath($val);
69 69
         };
70 70
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function testGetFilePathErrorFileNotFound()
83 83
     {
84 84
         $abstract = $this->newInstance();
85
-        $getFilePathCaller = function ($val) {
85
+        $getFilePathCaller = function($val) {
86 86
             return $this->getFilePath($val);
87 87
         };
88 88
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     public function testGetFilePathErrorFileIsNotLoaded()
98 98
     {
99 99
         $abstract = $this->newInstance();
100
-        $getFilePathCaller = function ($val) {
100
+        $getFilePathCaller = function($val) {
101 101
             return $this->getFilePath($val);
102 102
         };
103 103
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $abstract = $this->newInstance();
110 110
         $abstract->domain = 'echo.jsontest.com/aaa/bbb';
111
-        $getResponseCaller = function ($val) {
111
+        $getResponseCaller = function($val) {
112 112
             return $this->getResponse($val);
113 113
         };
114 114
         $bound = $getResponseCaller->bindTo($abstract, $abstract);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function testExecutionDelayed()
120 120
     {
121 121
         $abstract = $this->newInstance();
122
-        $executionDelayedCaller = function ($second, $call = null) {
122
+        $executionDelayedCaller = function($second, $call = null) {
123 123
             return $this->executionDelayed($second, $call);
124 124
         };
125 125
         $bound = $executionDelayedCaller->bindTo($abstract, $abstract);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $this->assertTrue(abs($timePassed - 0.1) < 0.025);
131 131
 
132 132
         $start = microtime(true);
133
-        $bound(0.15, function () {
133
+        $bound(0.15, function() {
134 134
             sleep(0.2);
135 135
         });
136 136
         $bound(0.1);
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
         $this->assertTrue(abs($timePassed - 0.25) < 0.025);
139 139
 
140 140
         $start = microtime(true);
141
-        $bound(0.15, function () {
141
+        $bound(0.15, function() {
142 142
             sleep(0.2);
143 143
         });
144 144
         $bound(0.3);
145 145
         $timePassed = microtime(true) - $start;
146 146
         $this->assertTrue(abs($timePassed - 0.45) < 0.025);
147 147
 
148
-        $this->assertEquals(2, $bound(0, function () {
148
+        $this->assertEquals(2, $bound(0, function() {
149 149
             return 2;
150 150
         }));
151 151
         $this->assertEquals(null, $bound(0));
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     public function testGetInUrl()
155 155
     {
156 156
         $abstract = $this->newInstance();
157
-        $getInUrlCaller = function () {
157
+        $getInUrlCaller = function() {
158 158
             return $this->getInUrl();
159 159
         };
160 160
         $abstract->domain = 'domain';
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     public function testIsError()
171 171
     {
172 172
         $abstract = $this->newInstance();
173
-        $isErrorCaller = function ($val) {
173
+        $isErrorCaller = function($val) {
174 174
             return $this->isError($val);
175 175
         };
176 176
         $bound = $isErrorCaller->bindTo($abstract, $abstract);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     public function testIsErrorNot()
181 181
     {
182 182
         $abstract = $this->newInstance();
183
-        $isErrorCaller = function ($val) {
183
+        $isErrorCaller = function($val) {
184 184
             return $this->isError($val);
185 185
         };
186 186
         $bound = $isErrorCaller->bindTo($abstract, $abstract);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     {
197 197
         $abstract = $this->newInstance();
198 198
         $abstract->domain = 'domain';
199
-        $getCurlResponseCaller = function ($val) {
199
+        $getCurlResponseCaller = function($val) {
200 200
             return $this->getCurlResponse($val);
201 201
         };
202 202
         $bound = $getCurlResponseCaller->bindTo($abstract, $abstract);
Please login to merge, or discard this patch.