Passed
Push — master ( 67ed62...5da465 )
by Gaetano
02:56
created
src/Helper/Http.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 
23 23
         // read chunk-size, chunk-extension (if any) and crlf
24 24
         // get the position of the linebreak
25
-        $chunkEnd = strpos($buffer, "\r\n") + 2;
25
+        $chunkEnd = strpos($buffer, "\r\n")+2;
26 26
         $temp = substr($buffer, 0, $chunkEnd);
27 27
         $chunkSize = hexdec(trim($temp));
28 28
         $chunkStart = $chunkEnd;
29
-        while ($chunkSize > 0) {
30
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize);
29
+        while ($chunkSize>0) {
30
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize);
31 31
 
32 32
             // just in case we got a broken connection
33 33
             if ($chunkEnd == false) {
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
             }
40 40
 
41 41
             // read chunk-data and crlf
42
-            $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
42
+            $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
43 43
             // append chunk-data to entity-body
44 44
             $new .= $chunk;
45 45
             // length := length + chunk-size
46 46
             $length += strlen($chunk);
47 47
             // read chunk-size and crlf
48
-            $chunkStart = $chunkEnd + 2;
48
+            $chunkStart = $chunkEnd+2;
49 49
 
50
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2;
50
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2;
51 51
             if ($chunkEnd == false) {
52 52
                 break; //just in case we got a broken connection
53 53
             }
54
-            $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
54
+            $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
55 55
             $chunkSize = hexdec(trim($temp));
56 56
             $chunkStart = $chunkEnd;
57 57
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @return array with keys 'headers' and 'cookies'
69 69
      * @throws \Exception
70 70
      */
71
-    public function parseResponseHeaders(&$data, $headersProcessed = false, $debug=0)
71
+    public function parseResponseHeaders(&$data, $headersProcessed = false, $debug = 0)
72 72
     {
73 73
         $httpResponse = array('raw_data' => $data, 'headers'=> array(), 'cookies' => array());
74 74
 
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
             // (even though it is not valid http)
79 79
             $pos = strpos($data, "\r\n\r\n");
80 80
             if ($pos || is_int($pos)) {
81
-                $bd = $pos + 4;
81
+                $bd = $pos+4;
82 82
             } else {
83 83
                 $pos = strpos($data, "\n\n");
84 84
                 if ($pos || is_int($pos)) {
85
-                    $bd = $pos + 2;
85
+                    $bd = $pos+2;
86 86
                 } else {
87 87
                     // No separation between response headers and body: fault?
88 88
                     $bd = 0;
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
                 // maybe we could take them into account, too?
94 94
                 $data = substr($data, $bd);
95 95
             } else {
96
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed');
97
-                throw new \Exception(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
96
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
97
+                throw new \Exception(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
98 98
             }
99 99
         }
100 100
 
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
         }
121 121
 
122 122
         if (!preg_match('/^HTTP\/[0-9.]+ 200 /', $data)) {
123
-            $errstr = substr($data, 0, strpos($data, "\n") - 1);
124
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr);
125
-            throw new \Exception(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error']);
123
+            $errstr = substr($data, 0, strpos($data, "\n")-1);
124
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr);
125
+            throw new \Exception(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error']);
126 126
         }
127 127
 
128 128
         // be tolerant to usage of \n instead of \r\n to separate headers and data
129 129
         // (even though it is not valid http)
130 130
         $pos = strpos($data, "\r\n\r\n");
131 131
         if ($pos || is_int($pos)) {
132
-            $bd = $pos + 4;
132
+            $bd = $pos+4;
133 133
         } else {
134 134
             $pos = strpos($data, "\n\n");
135 135
             if ($pos || is_int($pos)) {
136
-                $bd = $pos + 2;
136
+                $bd = $pos+2;
137 137
             } else {
138 138
                 // No separation between response headers and body: fault?
139 139
                 // we could take some action here instead of going on...
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
         // be tolerant to line endings, and extra empty lines
145 145
         $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos)));
146 146
 
147
-        foreach($ar as $line) {
147
+        foreach ($ar as $line) {
148 148
             // take care of multi-line headers and cookies
149 149
             $arr = explode(':', $line, 2);
150
-            if (count($arr) > 1) {
150
+            if (count($arr)>1) {
151 151
                 $headerName = strtolower(trim($arr[0]));
152 152
                 /// @todo some other headers (the ones that allow a CSV list of values)
153 153
                 /// do allow many values to be passed using multiple header lines.
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                         // glue together all received cookies, using a comma to separate them
166 166
                         // (same as php does with getallheaders())
167 167
                         if (isset($httpResponse['headers'][$headerName])) {
168
-                            $httpResponse['headers'][$headerName] .= ', ' . trim($cookie);
168
+                            $httpResponse['headers'][$headerName] .= ', '.trim($cookie);
169 169
                         } else {
170 170
                             $httpResponse['headers'][$headerName] = trim($cookie);
171 171
                         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
                 }
195 195
             } elseif (isset($headerName)) {
196 196
                 /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
197
-                $httpResponse['headers'][$headerName] .= ' ' . trim($line);
197
+                $httpResponse['headers'][$headerName] .= ' '.trim($line);
198 198
             }
199 199
         }
200 200
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             // Decode chunked encoding sent by http 1.1 servers
219 219
             if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') {
220 220
                 if (!$data = Http::decodeChunked($data)) {
221
-                    Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server');
221
+                    Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
222 222
                     throw new \Exception(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail']);
223 223
                 }
224 224
             }
@@ -233,19 +233,19 @@  discard block
 block discarded – undo
233 233
                         if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
234 234
                             $data = $degzdata;
235 235
                             if ($debug) {
236
-                                Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
236
+                                Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
237 237
                             }
238 238
                         } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
239 239
                             $data = $degzdata;
240 240
                             if ($debug) {
241
-                                Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
241
+                                Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
242 242
                             }
243 243
                         } else {
244
-                            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
244
+                            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
245 245
                             throw new \Exception(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail']);
246 246
                         }
247 247
                     } else {
248
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
248
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
249 249
                         throw new \Exception(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress']);
250 250
                     }
251 251
                 }
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
     public function xml_header($charsetEncoding = '')
39 39
     {
40 40
         if ($charsetEncoding != '') {
41
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
41
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
42 42
         } else {
43
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
43
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
44 44
         }
45 45
     }
46 46
 
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
     public function createPayload($charsetEncoding = '')
53 53
     {
54 54
         if ($charsetEncoding != '') {
55
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
55
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
56 56
         } else {
57 57
             $this->content_type = 'text/xml';
58 58
         }
59 59
         $this->payload = $this->xml_header($charsetEncoding);
60
-        $this->payload .= '<methodName>' . Charset::instance()->encodeEntities(
61
-            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
60
+        $this->payload .= '<methodName>'.Charset::instance()->encodeEntities(
61
+            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
62 62
         $this->payload .= "<params>\n";
63 63
         foreach ($this->params as $p) {
64
-            $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) .
64
+            $this->payload .= "<param>\n".$p->serialize($charsetEncoding).
65 65
                 "</param>\n";
66 66
         }
67 67
         $this->payload .= "</params>\n";
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
187 187
 
188 188
         if ($data == '') {
189
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.');
189
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.');
190 190
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
191 191
         }
192 192
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $httpParser = new Http();
196 196
             try {
197 197
                 $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug);
198
-            } catch(\Exception $e) {
198
+            } catch (\Exception $e) {
199 199
                 $r = new Response(0, $e->getCode(), $e->getMessage());
200 200
                 // failed processing of HTTP response headers
201 201
                 // save into response obj the full payload received, for debugging
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib
215 215
         $pos = strrpos($data, '</methodResponse>');
216 216
         if ($pos !== false) {
217
-            $data = substr($data, 0, $pos + 17);
217
+            $data = substr($data, 0, $pos+17);
218 218
         }
219 219
 
220 220
         // try to 'guestimate' the character encoding of the received response
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
             if ($start) {
226 226
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
227 227
                 $end = strpos($data, '-->', $start);
228
-                $comments = substr($data, $start, $end - $start);
229
-                Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" .
230
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding);
228
+                $comments = substr($data, $start, $end-$start);
229
+                Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t".
230
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding);
231 231
             }
232 232
         }
233 233
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                     if (extension_loaded('mbstring')) {
255 255
                         $data = mb_convert_encoding($data, 'UTF-8', $respEncoding);
256 256
                     } else {
257
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding);
257
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding);
258 258
                     }
259 259
                 }
260 260
             }
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
         $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE);
275 275
 
276 276
         // first error check: xml not well formed
277
-        if ($xmlRpcParser->_xh['isf'] > 2) {
277
+        if ($xmlRpcParser->_xh['isf']>2) {
278 278
 
279 279
             // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL'
280 280
 
281 281
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
282
-                PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
282
+                PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']);
283 283
 
284 284
             if ($this->debug) {
285 285
                 print $xmlRpcParser->_xh['isf_reason'];
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             }
293 293
 
294 294
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
295
-                PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
295
+                PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']);
296 296
         }
297 297
         // third error check: parsing of the response has somehow gone boink.
298 298
         // NB: shall we omit this check, since we trust the parsing code?
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
304 304
                 PhpXmlRpc::$xmlrpcstr['invalid_return']);
305 305
         } else {
306
-            if ($this->debug > 1) {
306
+            if ($this->debug>1) {
307 307
                 Logger::instance()->debugMessage(
308 308
                     "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---"
309 309
                 );
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
             $server = $parts['host'];
136 136
             $path = isset($parts['path']) ? $parts['path'] : '';
137 137
             if (isset($parts['query'])) {
138
-                $path .= '?' . $parts['query'];
138
+                $path .= '?'.$parts['query'];
139 139
             }
140 140
             if (isset($parts['fragment'])) {
141
-                $path .= '#' . $parts['fragment'];
141
+                $path .= '#'.$parts['fragment'];
142 142
             }
143 143
             if (isset($parts['port'])) {
144 144
                 $port = $parts['port'];
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             }
155 155
         }
156 156
         if ($path == '' || $path[0] != '/') {
157
-            $this->path = '/' . $path;
157
+            $this->path = '/'.$path;
158 158
         } else {
159 159
             $this->path = $path;
160 160
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         }*/
193 193
 
194 194
         // initialize user_agent string
195
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
195
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
196 196
     }
197 197
 
198 198
     /**
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      */
565 565
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
566 566
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
567
-        $method='http')
567
+        $method = 'http')
568 568
     {
569 569
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
570 570
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
      * @param int $sslVersion
597 597
      * @return Response
598 598
      */
599
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
599
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
600 600
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
601 601
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
602 602
         $sslVersion = 0)
@@ -633,11 +633,11 @@  discard block
 block discarded – undo
633 633
      */
634 634
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
635 635
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
636
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
636
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
637 637
         $sslVersion = 0)
638 638
     {
639 639
         if ($port == 0) {
640
-            $port = ( $method === 'https' ) ? 443 : 80;
640
+            $port = ($method === 'https') ? 443 : 80;
641 641
         }
642 642
 
643 643
         // Only create the payload if it was not created previously
@@ -667,15 +667,15 @@  discard block
 block discarded – undo
667 667
         // thanks to Grant Rauscher <[email protected]> for this
668 668
         $credentials = '';
669 669
         if ($username != '') {
670
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
670
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
671 671
             if ($authType != 1) {
672
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
672
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
673 673
             }
674 674
         }
675 675
 
676 676
         $acceptedEncoding = '';
677 677
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
678
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
678
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
679 679
         }
680 680
 
681 681
         $proxyCredentials = '';
@@ -686,17 +686,17 @@  discard block
 block discarded – undo
686 686
             $connectServer = $proxyHost;
687 687
             $connectPort = $proxyPort;
688 688
             $transport = 'tcp';
689
-            $uri = 'http://' . $server . ':' . $port . $this->path;
689
+            $uri = 'http://'.$server.':'.$port.$this->path;
690 690
             if ($proxyUsername != '') {
691 691
                 if ($proxyAuthType != 1) {
692
-                    Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
692
+                    Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
693 693
                 }
694
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
694
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
695 695
             }
696 696
         } else {
697 697
             $connectServer = $server;
698 698
             $connectPort = $port;
699
-            $transport = ( $method === 'https' ) ? 'tls' : 'tcp';
699
+            $transport = ($method === 'https') ? 'tls' : 'tcp';
700 700
             $uri = $this->path;
701 701
         }
702 702
 
@@ -706,45 +706,45 @@  discard block
 block discarded – undo
706 706
             $version = '';
707 707
             foreach ($this->cookies as $name => $cookie) {
708 708
                 if ($cookie['version']) {
709
-                    $version = ' $Version="' . $cookie['version'] . '";';
710
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
709
+                    $version = ' $Version="'.$cookie['version'].'";';
710
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
711 711
                     if ($cookie['path']) {
712
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
712
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
713 713
                     }
714 714
                     if ($cookie['domain']) {
715
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
715
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
716 716
                     }
717 717
                     if ($cookie['port']) {
718
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
718
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
719 719
                     }
720 720
                 } else {
721
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
721
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
722 722
                 }
723 723
             }
724
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
724
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
725 725
         }
726 726
 
727 727
         // omit port if default
728 728
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
729
-            $port =  '';
729
+            $port = '';
730 730
         } else {
731
-            $port = ':' . $port;
731
+            $port = ':'.$port;
732 732
         }
733 733
 
734
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
735
-            'User-Agent: ' . $this->user_agent . "\r\n" .
736
-            'Host: ' . $server . $port . "\r\n" .
737
-            $credentials .
738
-            $proxyCredentials .
739
-            $acceptedEncoding .
740
-            $encodingHdr .
741
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
742
-            $cookieHeader .
743
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
744
-            strlen($payload) . "\r\n\r\n" .
734
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
735
+            'User-Agent: '.$this->user_agent."\r\n".
736
+            'Host: '.$server.$port."\r\n".
737
+            $credentials.
738
+            $proxyCredentials.
739
+            $acceptedEncoding.
740
+            $encodingHdr.
741
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
742
+            $cookieHeader.
743
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
744
+            strlen($payload)."\r\n\r\n".
745 745
             $payload;
746 746
 
747
-        if ($this->debug > 1) {
747
+        if ($this->debug>1) {
748 748
             Logger::instance()->debugMessage("---SENDING---\n$op\n---END---");
749 749
         }
750 750
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
         }
771 771
         $context = stream_context_create($contextOptions);
772 772
 
773
-        if ($timeout <= 0) {
773
+        if ($timeout<=0) {
774 774
             $connectTimeout = ini_get('default_socket_timeout');
775 775
         } else {
776 776
             $connectTimeout = $timeout;
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
783 783
             STREAM_CLIENT_CONNECT, $context);
784 784
         if ($fp) {
785
-            if ($timeout > 0) {
785
+            if ($timeout>0) {
786 786
                 stream_set_timeout($fp, $timeout);
787 787
             }
788 788
         } else {
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
                 $err = error_get_last();
791 791
                 $this->errstr = $err['message'];
792 792
             }
793
-            $this->errstr = 'Connect error: ' . $this->errstr;
794
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
793
+            $this->errstr = 'Connect error: '.$this->errstr;
794
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
795 795
 
796 796
             return $r;
797 797
         }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
             $encodingHdr = '';
899 899
         }
900 900
 
901
-        if ($this->debug > 1) {
901
+        if ($this->debug>1) {
902 902
             Logger::instance()->debugMessage("---SENDING---\n$payload\n---END---");
903 903
         }
904 904
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
             } else {
909 909
                 $protocol = $method;
910 910
             }
911
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
911
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
912 912
             if ($keepAlive) {
913 913
                 $this->xmlrpc_curl_handle = $curl;
914 914
             }
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
         // results into variable
920 920
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
921 921
 
922
-        if ($this->debug > 1) {
922
+        if ($this->debug>1) {
923 923
             curl_setopt($curl, CURLOPT_VERBOSE, true);
924 924
             /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
925 925
         }
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
             }
945 945
         }
946 946
         // extra headers
947
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
947
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
948 948
         // if no keepalive is wanted, let the server know it in advance
949 949
         if (!$keepAlive) {
950 950
             $headers[] = 'Connection: close';
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
962 962
         // timeout is borked
963 963
         if ($timeout) {
964
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
964
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
965 965
         }
966 966
 
967 967
         if ($method == 'http10') {
@@ -971,11 +971,11 @@  discard block
 block discarded – undo
971 971
         }
972 972
 
973 973
         if ($username && $password) {
974
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
974
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
975 975
             if (defined('CURLOPT_HTTPAUTH')) {
976 976
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
977 977
             } elseif ($authType != 1) {
978
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
978
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
979 979
             }
980 980
         }
981 981
 
@@ -1017,13 +1017,13 @@  discard block
 block discarded – undo
1017 1017
             if ($proxyPort == 0) {
1018 1018
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1019 1019
             }
1020
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1020
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1021 1021
             if ($proxyUsername) {
1022
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1022
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1023 1023
                 if (defined('CURLOPT_PROXYAUTH')) {
1024 1024
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1025 1025
                 } elseif ($proxyAuthType != 1) {
1026
-                    Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1026
+                    Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1027 1027
                 }
1028 1028
             }
1029 1029
         }
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
         if (count($this->cookies)) {
1034 1034
             $cookieHeader = '';
1035 1035
             foreach ($this->cookies as $name => $cookie) {
1036
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1036
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1037 1037
             }
1038 1038
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1039 1039
         }
@@ -1044,13 +1044,13 @@  discard block
 block discarded – undo
1044 1044
 
1045 1045
         $result = curl_exec($curl);
1046 1046
 
1047
-        if ($this->debug > 1) {
1047
+        if ($this->debug>1) {
1048 1048
             $message = "---CURL INFO---\n";
1049 1049
             foreach (curl_getinfo($curl) as $name => $val) {
1050 1050
                 if (is_array($val)) {
1051 1051
                     $val = implode("\n", $val);
1052 1052
                 }
1053
-                $message .= $name . ': ' . $val . "\n";
1053
+                $message .= $name.': '.$val."\n";
1054 1054
             }
1055 1055
             $message .= '---END---';
1056 1056
             Logger::instance()->debugMessage($message);
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
             /// @todo we should use a better check here - what if we get back '' or '0'?
1061 1061
 
1062 1062
             $this->errstr = 'no response';
1063
-            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
1063
+            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
1064 1064
             curl_close($curl);
1065 1065
             if ($keepAlive) {
1066 1066
                 $this->xmlrpc_curl_handle = null;
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
             $call['methodName'] = new Value($req->method(), 'string');
1171 1171
             $numParams = $req->getNumParams();
1172 1172
             $params = array();
1173
-            for ($i = 0; $i < $numParams; $i++) {
1173
+            for ($i = 0; $i<$numParams; $i++) {
1174 1174
                 $params[$i] = $req->getParam($i);
1175 1175
             }
1176 1176
             $call['params'] = new Value($params, 'array');
@@ -1196,15 +1196,15 @@  discard block
 block discarded – undo
1196 1196
             /// @todo test this code branch...
1197 1197
             $rets = $result->value();
1198 1198
             if (!is_array($rets)) {
1199
-                return false;       // bad return type from system.multicall
1199
+                return false; // bad return type from system.multicall
1200 1200
             }
1201 1201
             $numRets = count($rets);
1202 1202
             if ($numRets != count($reqs)) {
1203
-                return false;       // wrong number of return values.
1203
+                return false; // wrong number of return values.
1204 1204
             }
1205 1205
 
1206 1206
             $response = array();
1207
-            for ($i = 0; $i < $numRets; $i++) {
1207
+            for ($i = 0; $i<$numRets; $i++) {
1208 1208
                 $val = $rets[$i];
1209 1209
                 if (!is_array($val)) {
1210 1210
                     return false;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
                 switch (count($val)) {
1213 1213
                     case 1:
1214 1214
                         if (!isset($val[0])) {
1215
-                            return false;       // Bad value
1215
+                            return false; // Bad value
1216 1216
                         }
1217 1217
                         // Normal return value
1218 1218
                         $response[$i] = new Response($val[0], 0, '', 'phpvals');
@@ -1240,19 +1240,19 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
             $rets = $result->value();
1242 1242
             if ($rets->kindOf() != 'array') {
1243
-                return false;       // bad return type from system.multicall
1243
+                return false; // bad return type from system.multicall
1244 1244
             }
1245 1245
             $numRets = $rets->count();
1246 1246
             if ($numRets != count($reqs)) {
1247
-                return false;       // wrong number of return values.
1247
+                return false; // wrong number of return values.
1248 1248
             }
1249 1249
 
1250 1250
             $response = array();
1251
-            foreach($rets as $val) {
1251
+            foreach ($rets as $val) {
1252 1252
                 switch ($val->kindOf()) {
1253 1253
                     case 'array':
1254 1254
                         if ($val->count() != 1) {
1255
-                            return false;       // Bad value
1255
+                            return false; // Bad value
1256 1256
                         }
1257 1257
                         // Normal return value
1258 1258
                         $response[] = new Response($val[0]);
Please login to merge, or discard this patch.
src/Value.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                     $this->me['struct'] = $val;
84 84
                     break;
85 85
                 default:
86
-                    Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
86
+                    Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)");
87 87
             }
88 88
         }
89 89
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         if ($typeOf !== 1) {
111
-            Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
111
+            Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
112 112
             return 0;
113 113
         }
114 114
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 
126 126
         switch ($this->mytype) {
127 127
             case 1:
128
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
128
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
129 129
                 return 0;
130 130
             case 3:
131
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
131
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
132 132
                 return 0;
133 133
             case 2:
134 134
                 // we're adding a scalar value to an array here
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
             return 1;
172 172
         } else {
173
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
173
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
174 174
             return 0;
175 175
         }
176 176
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
             return 1;
203 203
         } else {
204
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
204
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
205 205
             return 0;
206 206
         }
207 207
     }
@@ -240,19 +240,19 @@  discard block
 block discarded – undo
240 240
             case 1:
241 241
                 switch ($typ) {
242 242
                     case static::$xmlrpcBase64:
243
-                        $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>";
243
+                        $rs .= "<${typ}>".base64_encode($val)."</${typ}>";
244 244
                         break;
245 245
                     case static::$xmlrpcBoolean:
246
-                        $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
246
+                        $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>";
247 247
                         break;
248 248
                     case static::$xmlrpcString:
249 249
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
250
-                        $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>";
250
+                        $rs .= "<${typ}>".Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>";
251 251
                         break;
252 252
                     case static::$xmlrpcInt:
253 253
                     case static::$xmlrpcI4:
254 254
                     case static::$xmlrpcI8:
255
-                        $rs .= "<${typ}>" . (int)$val . "</${typ}>";
255
+                        $rs .= "<${typ}>".(int) $val."</${typ}>";
256 256
                         break;
257 257
                     case static::$xmlrpcDouble:
258 258
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -260,15 +260,15 @@  discard block
 block discarded – undo
260 260
                         // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
261 261
                         // The code below tries its best at keeping max precision while avoiding exp notation,
262 262
                         // but there is of course no limit in the number of decimal places to be used...
263
-                        $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, 128, '.', '')) . "</${typ}>";
263
+                        $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, 128, '.', ''))."</${typ}>";
264 264
                         break;
265 265
                     case static::$xmlrpcDateTime:
266 266
                         if (is_string($val)) {
267 267
                             $rs .= "<${typ}>${val}</${typ}>";
268 268
                         } elseif (is_a($val, 'DateTime')) {
269
-                            $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>";
269
+                            $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
270 270
                         } elseif (is_int($val)) {
271
-                            $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>";
271
+                            $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>";
272 272
                         } else {
273 273
                             // not really a good idea here: but what shall we output anyway? left for backward compat...
274 274
                             $rs .= "<${typ}>${val}</${typ}>";
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
             case 3:
291 291
                 // struct
292 292
                 if ($this->_php_class) {
293
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
293
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
294 294
                 } else {
295 295
                     $rs .= "<struct>\n";
296 296
                 }
297 297
                 $charsetEncoder = Charset::instance();
298 298
                 /** @var Value $val2 */
299 299
                 foreach ($val as $key2 => $val2) {
300
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
300
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
301 301
                     //$rs.=$this->serializeval($val2);
302 302
                     $rs .= $val2->serialize($charsetEncoding);
303 303
                     $rs .= "</member>\n";
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $val = reset($this->me);
334 334
         $typ = key($this->me);
335 335
 
336
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
336
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
337 337
     }
338 338
 
339 339
     /**
Please login to merge, or discard this patch.
src/Encoder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 return $xmlrpcVal->scalarval();
75 75
             case 'array':
76 76
                 $arr = array();
77
-                foreach($xmlrpcVal as $value) {
77
+                foreach ($xmlrpcVal as $value) {
78 78
                     $arr[] = $this->decode($value, $options);
79 79
                 }
80 80
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             case 'msg':
105 105
                 $paramCount = $xmlrpcVal->getNumParams();
106 106
                 $arr = array();
107
-                for ($i = 0; $i < $paramCount; $i++) {
107
+                for ($i = 0; $i<$paramCount; $i++) {
108 108
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
109 109
                 }
110 110
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                     $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
180 180
                 } else {
181 181
                     $arr = array();
182
-                    foreach($phpVal as $k => $v) {
182
+                    foreach ($phpVal as $k => $v) {
183 183
                         $arr[$k] = $this->encode($v, $options);
184 184
                     }
185 185
                     $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 break;
202 202
             case 'resource':
203 203
                 if (in_array('extension_api', $options)) {
204
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
204
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
205 205
                 } else {
206 206
                     $xmlrpcVal = new Value();
207 207
                 }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     if (extension_loaded('mbstring')) {
247 247
                         $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding);
248 248
                     } else {
249
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
249
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
250 250
                     }
251 251
                 }
252 252
             }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         $xmlRpcParser = new XMLParser($options);
263 263
         $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE);
264 264
 
265
-        if ($xmlRpcParser->_xh['isf'] > 1) {
265
+        if ($xmlRpcParser->_xh['isf']>1) {
266 266
             // test that $xmlrpc->_xh['value'] is an obj, too???
267 267
 
268 268
             Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 return $r;
287 287
             case 'methodcall':
288 288
                 $req = new Request($xmlRpcParser->_xh['method']);
289
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
289
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
290 290
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
291 291
                 }
292 292
 
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public static function xmlrpc_debugmsg($msg)
154 154
     {
155
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
155
+        static::$_xmlrpc_debuginfo .= $msg."\n";
156 156
     }
157 157
 
158 158
     /**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public static function error_occurred($msg)
162 162
     {
163
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
163
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
164 164
     }
165 165
 
166 166
     /**
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
180 180
         $out = '';
181 181
         if ($this->debug_info != '') {
182
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
182
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
183 183
         }
184 184
         if (static::$_xmlrpc_debuginfo != '') {
185
-            $out .= "<!-- DEBUG INFO:\n" . Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
185
+            $out .= "<!-- DEBUG INFO:\n".Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
186 186
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
187 187
             // into return payload AFTER the beginning tag
188 188
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
         $this->debug_info = '';
213 213
 
214 214
         // Save what we received, before parsing it
215
-        if ($this->debug > 1) {
216
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
215
+        if ($this->debug>1) {
216
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
217 217
         }
218 218
 
219 219
         $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
         // save full body of request into response, for more debugging usages
226 226
         $r->raw_data = $rawData;
227 227
 
228
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) {
229
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
230
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
228
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) {
229
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
230
+                static::$_xmlrpcs_occurred_errors."+++END+++");
231 231
         }
232 232
 
233 233
         $payload = $this->xml_header($respCharset);
234
-        if ($this->debug > 0) {
235
-            $payload = $payload . $this->serializeDebug($respCharset);
234
+        if ($this->debug>0) {
235
+            $payload = $payload.$this->serializeDebug($respCharset);
236 236
         }
237 237
 
238 238
         // Do not create response serialization if it has already happened. Helps building json magic
239 239
         if (empty($r->payload)) {
240 240
             $r->serialize($respCharset);
241 241
         }
242
-        $payload = $payload . $r->payload;
242
+        $payload = $payload.$r->payload;
243 243
 
244 244
         if ($returnPayload) {
245 245
             return $payload;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         // if we get a warning/error that has output some text before here, then we cannot
249 249
         // add a new header. We cannot say we are sending xml, either...
250 250
         if (!headers_sent()) {
251
-            header('Content-Type: ' . $r->content_type);
251
+            header('Content-Type: '.$r->content_type);
252 252
             // we do not know if client actually told us an accepted charset, but if he did
253 253
             // we have to tell him what we did
254 254
             header("Vary: Accept-Charset");
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
277 277
             // responses up to 8000 bytes
278 278
             if ($phpNoSelfCompress) {
279
-                header('Content-Length: ' . (int)strlen($payload));
279
+                header('Content-Length: '.(int) strlen($payload));
280 280
             }
281 281
         } else {
282
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
282
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
283 283
         }
284 284
 
285 285
         print $payload;
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
             $numParams = count($in);
329 329
         }
330 330
         foreach ($sigs as $curSig) {
331
-            if (count($curSig) == $numParams + 1) {
331
+            if (count($curSig) == $numParams+1) {
332 332
                 $itsOK = 1;
333
-                for ($n = 0; $n < $numParams; $n++) {
333
+                for ($n = 0; $n<$numParams; $n++) {
334 334
                     if (is_object($in)) {
335 335
                         $p = $in->getParam($n);
336 336
                         if ($p->kindOf() == 'scalar') {
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
                     }
344 344
 
345 345
                     // param index is $n+1, as first member of sig is return type
346
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
346
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
347 347
                         $itsOK = 0;
348
-                        $pno = $n + 1;
349
-                        $wanted = $curSig[$n + 1];
348
+                        $pno = $n+1;
349
+                        $wanted = $curSig[$n+1];
350 350
                         $got = $pt;
351 351
                         break;
352 352
                     }
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
         // check if $_SERVER is populated: it might have been disabled via ini file
374 374
         // (this is true even when in CLI mode)
375 375
         if (count($_SERVER) == 0) {
376
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
376
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
377 377
         }
378 378
 
379
-        if ($this->debug > 1) {
379
+        if ($this->debug>1) {
380 380
             if (function_exists('getallheaders')) {
381 381
                 $this->debugmsg(''); // empty line
382 382
                 foreach (getallheaders() as $name => $val) {
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
399 399
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
400 400
                         $data = $degzdata;
401
-                        if ($this->debug > 1) {
402
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
401
+                        if ($this->debug>1) {
402
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
403 403
                         }
404 404
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
405 405
                         $data = $degzdata;
406
-                        if ($this->debug > 1) {
407
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
406
+                        if ($this->debug>1) {
407
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
408 408
                         }
409 409
                     } else {
410 410
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']);
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                     if (extension_loaded('mbstring')) {
492 492
                         $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding);
493 493
                     } else {
494
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding);
494
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding);
495 495
                     }
496 496
                 }
497 497
             }
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
 
510 510
         $xmlRpcParser = new XMLParser($options);
511 511
         $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST);
512
-        if ($xmlRpcParser->_xh['isf'] > 2) {
512
+        if ($xmlRpcParser->_xh['isf']>2) {
513 513
             // (BC) we return XML error as a faultCode
514 514
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
515 515
             $r = new Response(0,
516
-                PhpXmlRpc::$xmlrpcerrxml + $matches[1],
516
+                PhpXmlRpc::$xmlrpcerrxml+$matches[1],
517 517
                 $xmlRpcParser->_xh['isf_reason']);
518 518
         } elseif ($xmlRpcParser->_xh['isf']) {
519 519
             $r = new Response(0,
520 520
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
521
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
521
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
522 522
         } else {
523 523
             // small layering violation in favor of speed and memory usage:
524 524
             // we should allow the 'execute' method handle this, but in the
@@ -529,20 +529,20 @@  discard block
 block discarded – undo
529 529
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] == 'phpvals')
530 530
                 )
531 531
             ) {
532
-                if ($this->debug > 1) {
533
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
532
+                if ($this->debug>1) {
533
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
534 534
                 }
535 535
                 $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
536 536
             } else {
537 537
                 // build a Request object with data parsed from xml
538 538
                 $req = new Request($xmlRpcParser->_xh['method']);
539 539
                 // now add parameters in
540
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
540
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
541 541
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
542 542
                 }
543 543
 
544
-                if ($this->debug > 1) {
545
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
544
+                if ($this->debug>1) {
545
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
546 546
                 }
547 547
                 $r = $this->execute($req);
548 548
             }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 return new Response(
596 596
                     0,
597 597
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
598
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}"
598
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}"
599 599
                 );
600 600
             }
601 601
         }
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
         if (is_array($func)) {
610 610
             if (is_object($func[0])) {
611
-                $funcName = get_class($func[0]) . '->' . $func[1];
611
+                $funcName = get_class($func[0]).'->'.$func[1];
612 612
             } else {
613 613
                 $funcName = implode('::', $func);
614 614
             }
@@ -620,17 +620,17 @@  discard block
 block discarded – undo
620 620
 
621 621
         // verify that function to be invoked is in fact callable
622 622
         if (!is_callable($func)) {
623
-            Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
623
+            Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
624 624
             return new Response(
625 625
                 0,
626 626
                 PhpXmlRpc::$xmlrpcerr['server_error'],
627
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
627
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
628 628
             );
629 629
         }
630 630
 
631 631
         // If debug level is 3, we should catch all errors generated during
632 632
         // processing of user function, and log them as part of response
633
-        if ($this->debug > 2) {
633
+        if ($this->debug>2) {
634 634
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
635 635
         }
636 636
 
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
                     $r = call_user_func($func, $req);
644 644
                 }
645 645
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
646
-                    Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
646
+                    Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
647 647
                     if (is_a($r, 'PhpXmlRpc\Value')) {
648 648
                         $r = new Response($r);
649 649
                     } else {
650 650
                         $r = new Response(
651 651
                             0,
652 652
                             PhpXmlRpc::$xmlrpcerr['server_error'],
653
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
653
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
654 654
                         );
655 655
                     }
656 656
                 }
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                         // mimic EPI behaviour: if we get an array that looks like an error, make it
667 667
                         // an eror response
668 668
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
669
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
669
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
670 670
                         } else {
671 671
                             // functions using EPI api should NOT return resp objects,
672 672
                             // so make sure we encode the return type correctly
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
             // in the called function, we wrap it in a proper error-response
691 691
             switch ($this->exception_handling) {
692 692
                 case 2:
693
-                    if ($this->debug > 2) {
693
+                    if ($this->debug>2) {
694 694
                         if (self::$_xmlrpcs_prev_ehandler) {
695 695
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
696 696
                         } else {
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
                     $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']);
707 707
             }
708 708
         }
709
-        if ($this->debug > 2) {
709
+        if ($this->debug>2) {
710 710
             // note: restore the error handler we found before calling the
711 711
             // user func, even if it has been changed inside the func itself
712 712
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
      */
727 727
     protected function debugmsg($string)
728 728
     {
729
-        $this->debug_info .= $string . "\n";
729
+        $this->debug_info .= $string."\n";
730 730
     }
731 731
 
732 732
     /**
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
     protected function xml_header($charsetEncoding = '')
737 737
     {
738 738
         if ($charsetEncoding != '') {
739
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
739
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
740 740
         } else {
741
-            return "<?xml version=\"1.0\"?" . ">\n";
741
+            return "<?xml version=\"1.0\"?".">\n";
742 742
         }
743 743
     }
744 744
 
@@ -971,12 +971,12 @@  discard block
 block discarded – undo
971 971
         }
972 972
 
973 973
         $req = new Request($methName->scalarval());
974
-        foreach($params as $i => $param) {
974
+        foreach ($params as $i => $param) {
975 975
             if (!$req->addParam($param)) {
976 976
                 $i++; // for error message, we count params from 1
977 977
                 return static::_xmlrpcs_multicall_error(new Response(0,
978 978
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
979
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
979
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
980 980
             }
981 981
         }
982 982
 
@@ -1043,12 +1043,12 @@  discard block
 block discarded – undo
1043 1043
         // let accept a plain list of php parameters, beside a single xmlrpc msg object
1044 1044
         if (is_object($req)) {
1045 1045
             $calls = $req->getParam(0);
1046
-            foreach($calls as $call) {
1046
+            foreach ($calls as $call) {
1047 1047
                 $result[] = static::_xmlrpcs_multicall_do_call($server, $call);
1048 1048
             }
1049 1049
         } else {
1050 1050
             $numCalls = count($req);
1051
-            for ($i = 0; $i < $numCalls; $i++) {
1051
+            for ($i = 0; $i<$numCalls; $i++) {
1052 1052
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1053 1053
             }
1054 1054
         }
Please login to merge, or discard this patch.
tests/1ParsingBugsTest.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,14 +19,16 @@
 block discarded – undo
19 19
     protected function set_up()
20 20
     {
21 21
         $this->args = argParser::getArgs();
22
-        if ($this->args['DEBUG'] == 1)
23
-            ob_start();
22
+        if ($this->args['DEBUG'] == 1) {
23
+                    ob_start();
24
+        }
24 25
     }
25 26
 
26 27
     protected function tear_down()
27 28
     {
28
-        if ($this->args['DEBUG'] != 1)
29
-            return;
29
+        if ($this->args['DEBUG'] != 1) {
30
+                    return;
31
+        }
30 32
         $out = ob_get_clean();
31 33
         $status = $this->getStatus();
32 34
         if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * NB: do not let your IDE fool you. The correct encoding for this file is NOT UTF8.
4 4
  */
5
-include_once __DIR__ . '/../lib/xmlrpc.inc';
6
-include_once __DIR__ . '/../lib/xmlrpcs.inc';
5
+include_once __DIR__.'/../lib/xmlrpc.inc';
6
+include_once __DIR__.'/../lib/xmlrpcs.inc';
7 7
 
8
-include_once __DIR__ . '/parse_args.php';
8
+include_once __DIR__.'/parse_args.php';
9 9
 
10
-include_once __DIR__ . '/PolyfillTestCase.php';
10
+include_once __DIR__.'/PolyfillTestCase.php';
11 11
 
12 12
 /**
13 13
  * Tests involving parsing of xml and handling of xmlrpc values
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function testUnicodeInMemberName()
65 65
     {
66
-        $str = "G" . chr(252) . "nter, El" . chr(232) . "ne";
66
+        $str = "G".chr(252)."nter, El".chr(232)."ne";
67 67
         $v = array($str => new xmlrpcval(1));
68 68
         $r = new xmlrpcresp(new xmlrpcval($v, 'struct'));
69 69
         $r = $r->serialize();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             '<?xml version="1.0"?>
80 80
 <!-- $Id -->
81 81
 <!-- found by G. Giunta, covers what happens when lib receives UTF8 chars in response text and comments -->
82
-<!-- ' . chr(224) . chr(252) . chr(232) . '&#224;&#252;&#232; -->
82
+<!-- ' . chr(224).chr(252).chr(232).'&#224;&#252;&#232; -->
83 83
 <methodResponse>
84 84
 <fault>
85 85
 <value>
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 </member>
91 91
 <member>
92 92
 <name>faultString</name>
93
-<value><string>' . chr(224) . chr(252) . chr(232) . '&#224;&#252;&#232;</string></value>
93
+<value><string>' . chr(224).chr(252).chr(232).'&#224;&#252;&#232;</string></value>
94 94
 </member>
95 95
 </struct>
96 96
 </value>
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $m = $this->newMsg('dummy');
100 100
         $r = $m->parseResponse($response);
101 101
         $v = $r->faultString();
102
-        $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v);
102
+        $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v);
103 103
     }
104 104
 
105 105
     public function testValidNumbers()
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     public function testI8()
162 162
     {
163
-        if (PHP_INT_SIZE == 4 ) {
163
+        if (PHP_INT_SIZE == 4) {
164 164
             $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode');
165 165
             return;
166 166
         }
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
 
484 484
     public function testUTF8Response()
485 485
     {
486
-        $string = chr(224) . chr(252) . chr(232);
486
+        $string = chr(224).chr(252).chr(232);
487 487
 
488 488
         $s = $this->newMsg('dummy');
489
-        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
490
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
489
+        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
490
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
491 491
 ';
492 492
         $r = $s->parseResponse($f, false, 'phpvals');
493 493
         $v = $r->value();
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
         $this->assertEquals($string, $v);
496 496
 
497 497
         $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
498
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
498
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
499 499
 ';
500 500
         $r = $s->parseResponse($f, false, 'phpvals');
501 501
         $v = $r->value();
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 
511 511
     public function testLatin1Response()
512 512
     {
513
-        $string = chr(224) . chr(252) . chr(232);
513
+        $string = chr(224).chr(252).chr(232);
514 514
 
515 515
         $s = $this->newMsg('dummy');
516
-        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
517
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
516
+        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
517
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
518 518
 ';
519 519
         $r = $s->parseResponse($f, false, 'phpvals');
520 520
         $v = $r->value();
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
         $this->assertEquals($string, $v);
523 523
 
524 524
         $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
525
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
525
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
526 526
 ';
527 527
         $r = $s->parseResponse($f, false, 'phpvals');
528 528
         $v = $r->value();
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
         $this->assertequals(1, count($v1));
618 618
         $out = array('me' => array(), 'mytype' => 2, '_php_class' => null);
619 619
 
620
-        foreach($v1 as $key => $val)
620
+        foreach ($v1 as $key => $val)
621 621
         {
622 622
             $this->assertArrayHasKey($key, $out);
623 623
             $expected = $out[$key];
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
         $this->assertequals(2, count($v2));
633 633
         $out = array(array('key' => 0, 'value'  => 'object'), array('key' => 1, 'value'  => 'object'));
634 634
         $i = 0;
635
-        foreach($v2 as $key => $val)
635
+        foreach ($v2 as $key => $val)
636 636
         {
637 637
             $expected = $out[$i];
638 638
             $this->assertequals($expected['key'], $key);
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
     {
646 646
         // nb: make sure that  the serialized xml corresponding to this is > 10MB in size
647 647
         $data = array();
648
-        for ($i = 0; $i < 500000; $i++ ) {
648
+        for ($i = 0; $i<500000; $i++) {
649 649
             $data[] = 'hello world';
650 650
         }
651 651
 
Please login to merge, or discard this patch.
tests/0CharsetTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 use PhpXmlRpc\Helper\Charset;
7 7
 
8
-include_once __DIR__ . '/PolyfillTestCase.php';
8
+include_once __DIR__.'/PolyfillTestCase.php';
9 9
 
10 10
 /**
11 11
  * Test conversion between encodings
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
     {
29 29
         // construct a latin string with all chars (except control ones)
30 30
         $this->latinString = "\n\r\t";
31
-        for($i = 32; $i < 127; $i++) {
31
+        for ($i = 32; $i<127; $i++) {
32 32
             $this->latinString .= chr($i);
33 33
         }
34
-        for($i = 160; $i < 256; $i++) {
34
+        for ($i = 160; $i<256; $i++) {
35 35
             $this->latinString .= chr($i);
36 36
         }
37 37
     }
Please login to merge, or discard this patch.
tests/PolyfillTestCase.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 }
8 8
 
9 9
 if (class_exists(PHPUnit_Version::class) === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) {
10
-    include_once __DIR__ . '/PolyfillTestCase7.php';
10
+    include_once __DIR__.'/PolyfillTestCase7.php';
11 11
 } else {
12
-    include_once __DIR__ . '/PolyfillTestCase8.php';
12
+    include_once __DIR__.'/PolyfillTestCase8.php';
13 13
 }
Please login to merge, or discard this patch.