Passed
Push — master ( d68788...24898d )
by Gaetano
10:00
created
tests/10DemofilesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for php files in the 'demo' directory.
Please login to merge, or discard this patch.
tests/08ServerTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
3
+include_once __DIR__.'/../lib/xmlrpc_wrappers.inc';
4 4
 
5
-include_once __DIR__ . '/ServerAwareTestCase.php';
5
+include_once __DIR__.'/ServerAwareTestCase.php';
6 6
 
7 7
 /**
8 8
  * Tests which involve interaction with the server - carried out via the client.
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         // (but only if not called from subclass objects / multitests)
30 30
         if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') {
31 31
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
32
-            for ($i = 0; $i < count($trace); $i++) {
32
+            for ($i = 0; $i<count($trace); $i++) {
33 33
                 if (strpos($trace[$i]['function'], 'test') === 0) {
34 34
                     self::$failed_tests[$trace[$i]['function']] = true;
35 35
                     break;
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         parent::set_up();
46 46
 
47 47
         $server = explode(':', $this->args['HTTPSERVER']);
48
-        if (count($server) > 1) {
48
+        if (count($server)>1) {
49 49
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]);
50 50
         } else {
51 51
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']);
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         }
76 76
         $this->validateResponse($r);
77 77
         if (is_array($errorCode)) {
78
-            $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
78
+            $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
79 79
         } else {
80
-            $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
80
+            $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
81 81
         }
82 82
         if (!$r->faultCode()) {
83 83
             if ($returnResponse) {
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
         $query = parse_url($this->client->path, PHP_URL_QUERY);
105 105
         parse_str($query, $vars);
106 106
         $query = http_build_query(array_merge($vars, $data));
107
-        $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query;
107
+        $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query;
108 108
     }
109 109
 
110 110
     public function testString()
111 111
     {
112
-        $sendString = "here are 3 \"entities\": < > & " .
113
-            "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
114
-            " - isn't that great? \\\"hackery\\\" at it's best " .
115
-            " also don't want to miss out on \$item[0]. " .
116
-            "The real weird stuff follows: CRLF here" . chr(13) . chr(10) .
117
-            "a simple CR here" . chr(13) .
118
-            "a simple LF here" . chr(10) .
119
-            "and then LFCR" . chr(10) . chr(13) .
120
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->";
112
+        $sendString = "here are 3 \"entities\": < > & ".
113
+            "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92).
114
+            " - isn't that great? \\\"hackery\\\" at it's best ".
115
+            " also don't want to miss out on \$item[0]. ".
116
+            "The real weird stuff follows: CRLF here".chr(13).chr(10).
117
+            "a simple CR here".chr(13).
118
+            "a simple LF here".chr(10).
119
+            "and then LFCR".chr(10).chr(13).
120
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->";
121 121
         $m = new xmlrpcmsg('examples.stringecho', array(
122 122
             new xmlrpcval($sendString, 'string'),
123 123
         ));
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public function testLatin1String()
139 139
     {
140 140
         $sendString =
141
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
141
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne";
142 142
         $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
143 143
             $sendString.
144 144
             '</value></param></params></methodCall>';
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     public function testUtf8Method()
248 248
     {
249 249
         PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
250
-        $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(
250
+        $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array(
251 251
             new xmlrpcval('hello')
252 252
         ));
253 253
         $v = $this->send($m);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         ));
269 269
         $v = $this->send($m);
270 270
         if ($v) {
271
-            $this->assertEquals($a + $b, $v->scalarval());
271
+            $this->assertEquals($a+$b, $v->scalarval());
272 272
         }
273 273
     }
274 274
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         ));
281 281
         $v = $this->send($m);
282 282
         if ($v) {
283
-            $this->assertEquals(12 - 23, $v->scalarval());
283
+            $this->assertEquals(12-23, $v->scalarval());
284 284
         }
285 285
     }
286 286
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         if ($v) {
320 320
             $sz = $v->arraysize();
321 321
             $got = '';
322
-            for ($i = 0; $i < $sz; $i++) {
322
+            for ($i = 0; $i<$sz; $i++) {
323 323
                 $b = $v->arraymem($i);
324 324
                 if ($b->scalarval()) {
325 325
                     $got .= '1';
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $got = '';
367 367
             $expected = '37210';
368 368
             $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
369
-            foreach($expect_array as $val) {
369
+            foreach ($expect_array as $val) {
370 370
                 $b = $v->structmem($val);
371 371
                 $got .= $b->me['int'];
372 372
             }
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
     {
869 869
         // make a 'deep client copy' as the original one might have many properties set
870 870
         // also for speed only wrap one method of the whole server
871
-        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' ));
871
+        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/'));
872 872
         if ($class == '') {
873 873
             $this->fail('Registration of remote server failed');
874 874
         } else {
@@ -907,9 +907,9 @@  discard block
 block discarded – undo
907 907
         $cookies = array(
908 908
             //'c1' => array(),
909 909
             'c2' => array('value' => 'c2'),
910
-            'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30),
911
-            'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'),
912
-            'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
910
+            'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30),
911
+            'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'),
912
+            'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
913 913
         );
914 914
         $cookiesval = php_xmlrpc_encode($cookies);
915 915
         $m = new xmlrpcmsg('tests.setcookies', array($cookiesval));
@@ -957,10 +957,10 @@  discard block
 block discarded – undo
957 957
         $m = new xmlrpcmsg('tests.getcookies', array());
958 958
         foreach ($cookies as $cookie => $val) {
959 959
             $this->client->setCookie($cookie, $val);
960
-            $cookies[$cookie] = (string)$cookies[$cookie];
960
+            $cookies[$cookie] = (string) $cookies[$cookie];
961 961
         }
962 962
         $r = $this->client->send($m, $this->timeout, $this->method);
963
-        $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
963
+        $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
964 964
         if (!$r->faultCode()) {
965 965
             $v = $r->value();
966 966
             $v = php_xmlrpc_decode($v);
Please login to merge, or discard this patch.
tests/WebTestCase.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/ServerAwareTestCase.php';
3
+include_once __DIR__.'/ServerAwareTestCase.php';
4 4
 
5 5
 abstract class PhpXmlRpc_WebTestCase extends PhpXmlRpc_ServerAwareTestCase
6 6
 {
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     protected function request($path, $method = 'GET', $payload = '', $emptyPageOk = false)
17 17
     {
18
-        $url = $this->baseUrl . $path;
18
+        $url = $this->baseUrl.$path;
19 19
 
20 20
         $ch = curl_init($url);
21 21
         curl_setopt_array($ch, array(
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         {
34 34
             curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID='.$this->testId);
35 35
         }
36
-        if ($this->args['DEBUG'] > 0) {
36
+        if ($this->args['DEBUG']>0) {
37 37
             curl_setopt($ch, CURLOPT_VERBOSE, 1);
38 38
         }
39 39
         $page = curl_exec($ch);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     protected function newClient($path)
59 59
     {
60
-        $client = new \PhpXmlRpc\Client($this->baseUrl . $path);
60
+        $client = new \PhpXmlRpc\Client($this->baseUrl.$path);
61 61
         if ($this->collectCodeCoverageInformation) {
62 62
             $client->setCookie('PHPUNIT_SELENIUM_TEST_ID', $this->testId);
63 63
         }
Please login to merge, or discard this patch.
tests/11DebuggerTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for the bundled debugger.
Please login to merge, or discard this patch.
tests/01CharsetTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * @author JoakimLofgren
4 4
  */
5 5
 
6
-include_once __DIR__ . '/PolyfillTestCase.php';
6
+include_once __DIR__.'/PolyfillTestCase.php';
7 7
 
8 8
 use PhpXmlRpc\Helper\Charset;
9 9
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
     public function testUtf8ToLatin1All()
49 49
     {
50 50
         $latinString = "\n\r\t";
51
-        for($i = 32; $i < 127; $i++) {
51
+        for ($i = 32; $i<127; $i++) {
52 52
             $latinString .= chr($i);
53 53
         }
54
-        for($i = 160; $i < 256; $i++) {
54
+        for ($i = 160; $i<256; $i++) {
55 55
             $latinString .= chr($i);
56 56
         }
57 57
 
Please login to merge, or discard this patch.
src/Helper/Http.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 
27 27
         // read chunk-size, chunk-extension (if any) and crlf
28 28
         // get the position of the linebreak
29
-        $chunkEnd = strpos($buffer, "\r\n") + 2;
29
+        $chunkEnd = strpos($buffer, "\r\n")+2;
30 30
         $temp = substr($buffer, 0, $chunkEnd);
31 31
         $chunkSize = hexdec(trim($temp));
32 32
         $chunkStart = $chunkEnd;
33
-        while ($chunkSize > 0) {
34
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize);
33
+        while ($chunkSize>0) {
34
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize);
35 35
 
36 36
             // just in case we got a broken connection
37 37
             if ($chunkEnd == false) {
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
             }
44 44
 
45 45
             // read chunk-data and crlf
46
-            $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
46
+            $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
47 47
             // append chunk-data to entity-body
48 48
             $new .= $chunk;
49 49
             // length := length + chunk-size
50 50
             $length += strlen($chunk);
51 51
             // read chunk-size and crlf
52
-            $chunkStart = $chunkEnd + 2;
52
+            $chunkStart = $chunkEnd+2;
53 53
 
54
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2;
54
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2;
55 55
             if ($chunkEnd == false) {
56 56
                 break; // just in case we got a broken connection
57 57
             }
58
-            $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
58
+            $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
59 59
             $chunkSize = hexdec(trim($temp));
60 60
             $chunkStart = $chunkEnd;
61 61
         }
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
             // Look for CR/LF or simple LF as line separator (even though it is not valid http)
85 85
             $pos = strpos($data, "\r\n\r\n");
86 86
             if ($pos || is_int($pos)) {
87
-                $bd = $pos + 4;
87
+                $bd = $pos+4;
88 88
             } else {
89 89
                 $pos = strpos($data, "\n\n");
90 90
                 if ($pos || is_int($pos)) {
91
-                    $bd = $pos + 2;
91
+                    $bd = $pos+2;
92 92
                 } else {
93 93
                     // No separation between response headers and body: fault?
94 94
                     $bd = 0;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                 // this filters out all http headers from proxy. maybe we could take them into account, too?
99 99
                 $data = substr($data, $bd);
100 100
             } else {
101
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed');
102
-                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
101
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
102
+                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
103 103
             }
104 104
         }
105 105
 
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
         }
133 133
 
134 134
         if ($httpResponse['status_code'] !== '200') {
135
-            $errstr = substr($data, 0, strpos($data, "\n") - 1);
136
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr);
137
-            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
135
+            $errstr = substr($data, 0, strpos($data, "\n")-1);
136
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr);
137
+            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
138 138
         }
139 139
 
140 140
         // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http)
141 141
         $pos = strpos($data, "\r\n\r\n");
142 142
         if ($pos || is_int($pos)) {
143
-            $bd = $pos + 4;
143
+            $bd = $pos+4;
144 144
         } else {
145 145
             $pos = strpos($data, "\n\n");
146 146
             if ($pos || is_int($pos)) {
147
-                $bd = $pos + 2;
147
+                $bd = $pos+2;
148 148
             } else {
149 149
                 // No separation between response headers and body: fault?
150 150
                 // we could take some action here instead of going on...
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         foreach ($ar as $line) {
159 159
             // take care of (multi-line) headers and cookies
160 160
             $arr = explode(':', $line, 2);
161
-            if (count($arr) > 1) {
161
+            if (count($arr)>1) {
162 162
                 /// @todo according to https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should reject with error
163 163
                 ///       400 any messages where a space is present between the header name and colon
164 164
                 $headerName = strtolower(trim($arr[0]));
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                     $cookie = $arr[1];
167 167
                     // glue together all received cookies, using a comma to separate them (same as php does with getallheaders())
168 168
                     if (isset($httpResponse['headers'][$headerName])) {
169
-                        $httpResponse['headers'][$headerName] .= ', ' . trim($cookie);
169
+                        $httpResponse['headers'][$headerName] .= ', '.trim($cookie);
170 170
                     } else {
171 171
                         $httpResponse['headers'][$headerName] = trim($cookie);
172 172
                     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             } elseif (isset($headerName)) {
198 198
                 /// @todo improve this: 1. check that the line starts with a space or tab; 2. according to
199 199
                 ///       https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should flat out refuse these messages
200
-                $httpResponse['headers'][$headerName] .= ' ' . trim($line);
200
+                $httpResponse['headers'][$headerName] .= ' '.trim($line);
201 201
             }
202 202
         }
203 203
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             // Decode chunked encoding sent by http 1.1 servers
221 221
             if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') {
222 222
                 if (!$data = static::decodeChunked($data)) {
223
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server');
223
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
224 224
                     throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']);
225 225
                 }
226 226
             }
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
                         if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
236 236
                             $data = $degzdata;
237 237
                             if ($debug) {
238
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
238
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
239 239
                             }
240 240
                         } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
241 241
                             $data = $degzdata;
242 242
                             if ($debug) {
243
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
243
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
244 244
                             }
245 245
                         } else {
246
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
246
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
247 247
                             throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']);
248 248
                         }
249 249
                     } else {
250
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
250
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
251 251
                         throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']);
252 252
                     }
253 253
                 }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     public function parseAcceptHeader($header)
268 268
     {
269 269
         $accepted = array();
270
-        foreach(explode(',', $header) as $c) {
270
+        foreach (explode(',', $header) as $c) {
271 271
             if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) {
272 272
                 $c = $matches[1];
273 273
                 $w = $matches[2];
Please login to merge, or discard this patch.
src/Helper/XMLParser.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
             // q: can php be built without ctype? should we use a regexp?
184 184
             if (is_string($key) && !ctype_digit($key)) {
185 185
                 /// @todo on invalid options, throw/error-out instead of logging an error message?
186
-                switch($key) {
186
+                switch ($key) {
187 187
                     case 'target_charset':
188 188
                         if (function_exists('mb_convert_encoding')) {
189 189
                             $this->current_parsing_options['target_charset'] = $val;
190 190
                         } else {
191
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring");
191
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring");
192 192
                         }
193 193
                         break;
194 194
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                         if (is_callable($val)) {
197 197
                             $this->current_parsing_options['methodname_callback'] = $val;
198 198
                         } else {
199
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable");
199
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable");
200 200
                         }
201 201
                         break;
202 202
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                         break;
208 208
 
209 209
                     default:
210
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": unsupported option: $key");
210
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": unsupported option: $key");
211 211
                 }
212 212
                 unset($mergedOptions[$key]);
213 213
             }
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 
254 254
         try {
255 255
             // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors
256
-            for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
256
+            for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
257 257
                 $chunk = substr($data, $offset, $this->maxChunkLength);
258 258
                 // error handling: xml not well formed
259
-                if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
259
+                if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
260 260
                     $errCode = xml_get_error_code($parser);
261 261
                     $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
262 262
                         xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                     $this->_xh['isf_reason'] = $errStr;
266 266
                 }
267 267
                 // no need to parse further if we already have a fatal error
268
-                if ($this->_xh['isf'] >= 2) {
268
+                if ($this->_xh['isf']>=2) {
269 269
                     break;
270 270
                 }
271 271
             }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
304 304
     {
305 305
         // if invalid xml-rpc already detected, skip all processing
306
-        if ($this->_xh['isf'] >= 2) {
306
+        if ($this->_xh['isf']>=2) {
307 307
             return;
308 308
         }
309 309
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                 $this->_xh['rt'] = strtolower($name);
328 328
             } else {
329 329
                 $this->_xh['isf'] = 2;
330
-                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
330
+                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
331 331
 
332 332
                 return;
333 333
             }
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
             case 'MEMBER':
431 431
                 // set member name to null, in case we do not find in the xml later on
432
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null;
432
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null;
433 433
                 //$this->_xh['ac']='';
434 434
                 // Drop trough intentionally
435 435
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
      */
510 510
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
511 511
     {
512
-        if ($this->_xh['isf'] >= 2) {
512
+        if ($this->_xh['isf']>=2) {
513 513
             return;
514 514
         }
515 515
 
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                     $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8');
532 532
                 }
533 533
 
534
-                if ($rebuildXmlrpcvals > 0) {
534
+                if ($rebuildXmlrpcvals>0) {
535 535
                     // build the xml-rpc val out of the data received, and substitute it
536 536
                     $temp = new Value($this->_xh['value'], $this->_xh['vt']);
537 537
                     // in case we got info about underlying php class, save it in the object we're rebuilding
@@ -539,15 +539,15 @@  discard block
 block discarded – undo
539 539
                         $temp->_php_class = $this->_xh['php_class'];
540 540
                     }
541 541
                     $this->_xh['value'] = $temp;
542
-                } elseif ($rebuildXmlrpcvals < 0) {
542
+                } elseif ($rebuildXmlrpcvals<0) {
543 543
                     if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
544
-                        $this->_xh['value'] = (object)array(
544
+                        $this->_xh['value'] = (object) array(
545 545
                             'xmlrpc_type' => 'datetime',
546 546
                             'scalar' => $this->_xh['value'],
547 547
                             'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
548 548
                         );
549 549
                     } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
550
-                        $this->_xh['value'] = (object)array(
550
+                        $this->_xh['value'] = (object) array(
551 551
                             'xmlrpc_type' => 'base64',
552 552
                             'scalar' => $this->_xh['value']
553 553
                         );
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
                 // check if we are inside an array or struct:
563 563
                 // if value just built is inside an array, let's move it into array on the stack
564 564
                 $vscount = count($this->_xh['valuestack']);
565
-                if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
566
-                    $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
565
+                if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
566
+                    $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
567 567
                 }
568 568
                 break;
569 569
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
                     // log if receiving something strange, even though we set the value to false anyway
591 591
                     /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL
592 592
                     if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
593
-                        if (!$this->handleParsingError('invalid data received in BOOLEAN value: ' .
593
+                        if (!$this->handleParsingError('invalid data received in BOOLEAN value: '.
594 594
                             $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
595 595
                             return;
596 596
                         }
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
                 $this->_xh['vt'] = strtolower($name);
611 611
                 $this->_xh['lv'] = 3; // indicate we've found a value
612 612
                 if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) {
613
-                    if (!$this->handleParsingError('non numeric data received in INT value: ' .
613
+                    if (!$this->handleParsingError('non numeric data received in INT value: '.
614 614
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
615 615
                         return;
616 616
                     }
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
619 619
                 } else {
620 620
                     // it's ok, add it on
621
-                    $this->_xh['value'] = (int)$this->_xh['ac'];
621
+                    $this->_xh['value'] = (int) $this->_xh['ac'];
622 622
                 }
623 623
                 break;
624 624
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
                 $this->_xh['vt'] = Value::$xmlrpcDouble;
627 627
                 $this->_xh['lv'] = 3; // indicate we've found a value
628 628
                 if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) {
629
-                    if (!$this->handleParsingError('non numeric data received in DOUBLE value: ' .
629
+                    if (!$this->handleParsingError('non numeric data received in DOUBLE value: '.
630 630
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
631 631
                         return;
632 632
                     }
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
635 635
                 } else {
636 636
                     // it's ok, add it on
637
-                    $this->_xh['value'] = (double)$this->_xh['ac'];
637
+                    $this->_xh['value'] = (double) $this->_xh['ac'];
638 638
                 }
639 639
                 break;
640 640
 
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
                 $this->_xh['vt'] = Value::$xmlrpcDateTime;
643 643
                 $this->_xh['lv'] = 3; // indicate we've found a value
644 644
                 if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) {
645
-                    if (!$this->handleParsingError('invalid data received in DATETIME value: ' .
645
+                    if (!$this->handleParsingError('invalid data received in DATETIME value: '.
646 646
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
647 647
                         return;
648 648
                     }
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
 
654 654
                     // the default regex used to validate the date string a few lines above should make this case impossible,
655 655
                     // but one never knows...
656
-                    } catch(\Exception $e) {
656
+                    } catch (\Exception $e) {
657 657
                         // what to do? We can not guarantee that a valid date can be created. We return null...
658
-                        if (!$this->handleParsingError('invalid data received in DATETIME value. Error ' .
658
+                        if (!$this->handleParsingError('invalid data received in DATETIME value. Error '.
659 659
                             $e->getMessage(), __METHOD__)) {
660 660
                             return;
661 661
                         }
@@ -672,14 +672,14 @@  discard block
 block discarded – undo
672 672
                     $v = base64_decode($this->_xh['ac'], true);
673 673
                     if ($v === false) {
674 674
                         $this->_xh['isf'] = 2;
675
-                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateValueForLog($this->_xh['ac']);
675
+                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateValueForLog($this->_xh['ac']);
676 676
                         return;
677 677
                     }
678 678
                 } else {
679 679
                     $v = base64_decode($this->_xh['ac']);
680 680
                     if ($v === '' && $this->_xh['ac'] !== '') {
681 681
                         // only the empty string should decode to the empty string
682
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' .
682
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '.
683 683
                             $this->truncateValueForLog($this->_xh['ac']));
684 684
                     }
685 685
                 }
@@ -687,20 +687,20 @@  discard block
 block discarded – undo
687 687
                 break;
688 688
 
689 689
             case 'NAME':
690
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
690
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
691 691
                 break;
692 692
 
693 693
             case 'MEMBER':
694 694
                 // add to array in the stack the last element built, unless no VALUE or no NAME were found
695 695
                 if ($this->_xh['vt']) {
696 696
                     $vscount = count($this->_xh['valuestack']);
697
-                    if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) {
697
+                    if ($this->_xh['valuestack'][$vscount-1]['name'] === null) {
698 698
                         if (!$this->handleParsingError('missing NAME inside STRUCT in received xml', __METHOD__)) {
699 699
                             return;
700 700
                         }
701
-                        $this->_xh['valuestack'][$vscount - 1]['name'] = '';
701
+                        $this->_xh['valuestack'][$vscount-1]['name'] = '';
702 702
                     }
703
-                    $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
703
+                    $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
704 704
                 } else {
705 705
                     if (!$this->handleParsingError('missing VALUE inside STRUCT in received xml', __METHOD__)) {
706 706
                         return;
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
     public function xmlrpc_cd($parser, $data)
817 817
     {
818 818
         // skip processing if xml fault already detected
819
-        if ($this->_xh['isf'] >= 2) {
819
+        if ($this->_xh['isf']>=2) {
820 820
             return;
821 821
         }
822 822
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
     public function xmlrpc_dh($parser, $data)
839 839
     {
840 840
         // skip processing if xml fault already detected
841
-        if ($this->_xh['isf'] >= 2) {
841
+        if ($this->_xh['isf']>=2) {
842 842
             return;
843 843
         }
844 844
 
@@ -912,8 +912,8 @@  discard block
 block discarded – undo
912 912
         // Details:
913 913
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
914 914
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
915
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
916
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
915
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
916
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
917 917
             $xmlChunk, $matches)) {
918 918
             return strtoupper(substr($matches[2], 1, -1));
919 919
         }
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
932 932
             // IANA also likes better US-ASCII, so go with it
933 933
             if ($enc == 'ASCII') {
934
-                $enc = 'US-' . $enc;
934
+                $enc = 'US-'.$enc;
935 935
             }
936 936
 
937 937
             return $enc;
@@ -968,8 +968,8 @@  discard block
 block discarded – undo
968 968
         // Details:
969 969
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
970 970
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
971
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
972
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
971
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
972
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
973 973
             $xmlChunk)) {
974 974
             return true;
975 975
         }
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
             $this->_xh['isf_reason'] = ucfirst($message);
990 990
             return false;
991 991
         } else {
992
-            $this->getLogger()->error('XML-RPC: ' . ($method != '' ? $method . ': ' : '') . $message);
992
+            $this->getLogger()->error('XML-RPC: '.($method != '' ? $method.': ' : '').$message);
993 993
             return true;
994 994
         }
995 995
     }
@@ -1001,8 +1001,8 @@  discard block
 block discarded – undo
1001 1001
      */
1002 1002
     protected function truncateValueForLog($data)
1003 1003
     {
1004
-        if (strlen($data) > $this->maxLogValueLength) {
1005
-            return substr($data, 0, $this->maxLogValueLength - 3) . '...';
1004
+        if (strlen($data)>$this->maxLogValueLength) {
1005
+            return substr($data, 0, $this->maxLogValueLength-3).'...';
1006 1006
         }
1007 1007
 
1008 1008
         return $data;
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
                 break;
1022 1022
             default:
1023 1023
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1024
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1024
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1025 1025
         }
1026 1026
     }
1027 1027
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
                 break;
1047 1047
             default:
1048 1048
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1049
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1049
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1050 1050
         }
1051 1051
     }
1052 1052
 }
Please login to merge, or discard this patch.
tests/03MessagesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/LoggerAwareTestCase.php';
3
+include_once __DIR__.'/LoggerAwareTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests involving Requests and Responses, except for the parsing part
Please login to merge, or discard this patch.
tests/06EncoderTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/LoggerAwareTestCase.php';
3
+include_once __DIR__.'/LoggerAwareTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests involving automatic encoding/decoding of php values into xmlrpc values (the Encoder class).
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing.
76 76
         ///       We should fix that, then re-enable this test
77 77
         if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
78
-            $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>');
78
+            $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>');
79 79
             $this->assertEquals($string, $i->scalarVal());
80 80
         }
81 81
 
Please login to merge, or discard this patch.