Passed
Push — master ( 9efc10...10c1ae )
by Gaetano
07:13
created
src/Encoder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
                                 'scalar' => $val,
58 58
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val)
59 59
                             );
60
-                            return (object)$xmlrpcVal;
60
+                            return (object) $xmlrpcVal;
61 61
                         case 'base64':
62 62
                             $xmlrpcVal = array(
63 63
                                 'xmlrpc_type' => 'base64',
64 64
                                 'scalar' => $val
65 65
                             );
66
-                            return (object)$xmlrpcVal;
66
+                            return (object) $xmlrpcVal;
67 67
                         case 'string':
68 68
                             if (isset($options['extension_api_encoding'])) {
69 69
                                 // if iconv is not available, we use mb_convert_encoding
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             case 'msg':
137 137
                 $paramCount = $xmlrpcVal->getNumParams();
138 138
                 $arr = array();
139
-                for ($i = 0; $i < $paramCount; $i++) {
139
+                for ($i = 0; $i<$paramCount; $i++) {
140 140
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
141 141
                 }
142 142
                 return $arr;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 break;
262 262
             case 'resource':
263 263
                 if (in_array('extension_api', $options)) {
264
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
264
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
265 265
                 } else {
266 266
                     $xmlrpcVal = new Value();
267 267
                 }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     if ($valEncoding == 'ISO-8859-1') {
311 311
                         $xmlVal = utf8_encode($xmlVal);
312 312
                     } else {
313
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
313
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
314 314
                     }
315 315
                 }
316 316
             }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             $parserOptions
333 333
         );
334 334
 
335
-        if ($xmlRpcParser->_xh['isf'] > 1) {
335
+        if ($xmlRpcParser->_xh['isf']>1) {
336 336
             // test that $xmlrpc->_xh['value'] is an obj, too???
337 337
 
338 338
             $this->getLogger()->error($xmlRpcParser->_xh['isf_reason']);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
             case 'methodcall':
358 358
                 $req = new Request($xmlRpcParser->_xh['method']);
359
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
359
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
360 360
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
361 361
                 }
362 362
                 return $req;
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
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     $this->me['struct'] = $val;
94 94
                     break;
95 95
                 default:
96
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
96
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)");
97 97
             }
98 98
         }
99 99
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         if ($typeOf !== 1) {
120
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
120
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
121 121
             return 0;
122 122
         }
123 123
 
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 
135 135
         switch ($this->mytype) {
136 136
             case 1:
137
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
137
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
138 138
                 return 0;
139 139
             case 3:
140
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
140
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
141 141
                 return 0;
142 142
             case 2:
143 143
                 // we're adding a scalar value to an array here
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
             return 1;
181 181
         } else {
182
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
182
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
183 183
             return 0;
184 184
         }
185 185
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             return 1;
211 211
         } else {
212
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
212
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
213 213
             return 0;
214 214
         }
215 215
     }
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
             case 1:
252 252
                 switch ($typ) {
253 253
                     case static::$xmlrpcBase64:
254
-                        $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
254
+                        $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>";
255 255
                         break;
256 256
                     case static::$xmlrpcBoolean:
257
-                        $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
257
+                        $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>";
258 258
                         break;
259 259
                     case static::$xmlrpcString:
260 260
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
261
-                        $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>";
261
+                        $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>";
262 262
                         break;
263 263
                     case static::$xmlrpcInt:
264 264
                     case static::$xmlrpcI4:
265 265
                     case static::$xmlrpcI8:
266
-                        $rs .= "<{$typ}>" . (int)$val . "</{$typ}>";
266
+                        $rs .= "<{$typ}>".(int) $val."</{$typ}>";
267 267
                         break;
268 268
                     case static::$xmlrpcDouble:
269 269
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
                         // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14.
272 272
                         // The code below tries its best at keeping max precision while avoiding exp notation,
273 273
                         // but there is of course no limit in the number of decimal places to be used...
274
-                        $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>";
274
+                        $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>";
275 275
                         break;
276 276
                     case static::$xmlrpcDateTime:
277 277
                         if (is_string($val)) {
278 278
                             $rs .= "<{$typ}>{$val}</{$typ}>";
279 279
                         // DateTimeInterface is not present in php 5.4...
280 280
                         } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) {
281
-                            $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>";
281
+                            $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>";
282 282
                         } elseif (is_int($val)) {
283
-                            $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>";
283
+                            $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>";
284 284
                         } else {
285 285
                             // not really a good idea here: but what should we output anyway? left for backward compat...
286 286
                             $rs .= "<{$typ}>{$val}</{$typ}>";
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
             case 3:
303 303
                 // struct
304 304
                 if ($this->_php_class) {
305
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
305
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
306 306
                 } else {
307 307
                     $rs .= "<struct>\n";
308 308
                 }
309 309
                 $charsetEncoder = $this->getCharsetEncoder();
310 310
                 /** @var Value $val2 */
311 311
                 foreach ($val as $key2 => $val2) {
312
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
312
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
313 313
                     //$rs.=$this->serializeval($val2);
314 314
                     $rs .= $val2->serialize($charsetEncoding);
315 315
                     $rs .= "</member>\n";
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         $val = reset($this->me);
345 345
         $typ = key($this->me);
346 346
 
347
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
347
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
348 348
     }
349 349
 
350 350
     /**
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public static function xmlrpc_debugmsg($msg)
193 193
     {
194
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
194
+        static::$_xmlrpc_debuginfo .= $msg."\n";
195 195
     }
196 196
 
197 197
     /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public static function error_occurred($msg)
205 205
     {
206
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
206
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
207 207
     }
208 208
 
209 209
     /**
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
225 225
         $out = '';
226 226
         if ($this->debug_info != '') {
227
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
227
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
228 228
         }
229 229
         if (static::$_xmlrpc_debuginfo != '') {
230
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
230
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
231 231
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
232 232
             // into return payload AFTER the beginning tag
233 233
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
         $this->debug_info = '';
257 257
 
258 258
         // Save what we received, before parsing it
259
-        if ($this->debug > 1) {
260
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
259
+        if ($this->debug>1) {
260
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
261 261
         }
262 262
 
263 263
         $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
             $resp->raw_data = $rawData;
275 275
         }
276 276
 
277
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
278
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
279
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
277
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
278
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
279
+                static::$_xmlrpcs_occurred_errors."+++END+++");
280 280
         }
281 281
 
282 282
         $payload = $this->xml_header($respCharset);
283
-        if ($this->debug > 0) {
284
-            $payload = $payload . $this->serializeDebug($respCharset);
283
+        if ($this->debug>0) {
284
+            $payload = $payload.$this->serializeDebug($respCharset);
285 285
         }
286 286
 
287 287
         // Do not create response serialization if it has already happened. Helps to build json magic
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         if (empty($resp->payload)) {
290 290
             $resp->serialize($respCharset);
291 291
         }
292
-        $payload = $payload . $resp->payload;
292
+        $payload = $payload.$resp->payload;
293 293
 
294 294
         if ($returnPayload) {
295 295
             return $payload;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         // if we get a warning/error that has output some text before here, then we cannot
299 299
         // add a new header. We cannot say we are sending xml, either...
300 300
         if (!headers_sent()) {
301
-            header('Content-Type: ' . $resp->content_type);
301
+            header('Content-Type: '.$resp->content_type);
302 302
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
303 303
             header("Vary: Accept-Charset");
304 304
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
322 322
             // responses up to 8000 bytes
323 323
             if ($phpNoSelfCompress) {
324
-                header('Content-Length: ' . (int)strlen($payload));
324
+                header('Content-Length: '.(int) strlen($payload));
325 325
             }
326 326
         } else {
327
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
327
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
328 328
         }
329 329
 
330 330
         print $payload;
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
             $numParams = count($in);
383 383
         }
384 384
         foreach ($sigs as $curSig) {
385
-            if (count($curSig) == $numParams + 1) {
385
+            if (count($curSig) == $numParams+1) {
386 386
                 $itsOK = 1;
387
-                for ($n = 0; $n < $numParams; $n++) {
387
+                for ($n = 0; $n<$numParams; $n++) {
388 388
                     if (is_object($in)) {
389 389
                         $p = $in->getParam($n);
390 390
                         if ($p->kindOf() == 'scalar') {
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
                     }
398 398
 
399 399
                     // param index is $n+1, as first member of sig is return type
400
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
400
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
401 401
                         $itsOK = 0;
402
-                        $pno = $n + 1;
403
-                        $wanted = $curSig[$n + 1];
402
+                        $pno = $n+1;
403
+                        $wanted = $curSig[$n+1];
404 404
                         $got = $pt;
405 405
                         break;
406 406
                     }
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
         // check if $_SERVER is populated: it might have been disabled via ini file
428 428
         // (this is true even when in CLI mode)
429 429
         if (count($_SERVER) == 0) {
430
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
430
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
431 431
         }
432 432
 
433
-        if ($this->debug > 1) {
433
+        if ($this->debug>1) {
434 434
             if (function_exists('getallheaders')) {
435 435
                 $this->debugmsg(''); // empty line
436 436
                 foreach (getallheaders() as $name => $val) {
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
456 456
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
457 457
                         $data = $degzdata;
458
-                        if ($this->debug > 1) {
459
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
458
+                        if ($this->debug>1) {
459
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
460 460
                         }
461 461
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
462 462
                         $data = $degzdata;
463
-                        if ($this->debug > 1) {
464
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
463
+                        if ($this->debug>1) {
464
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
465 465
                         }
466 466
                     } else {
467 467
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
                     if ($reqEncoding == 'ISO-8859-1') {
549 549
                         $data = utf8_encode($data);
550 550
                     } else {
551
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding);
551
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding);
552 552
                     }
553 553
                 }
554 554
             }
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
576 576
             return new Response(
577 577
                 0,
578
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
578
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
579 579
                 $xmlRpcParser->_xh['isf_reason']);
580 580
         } elseif ($xmlRpcParser->_xh['isf']) {
581 581
             /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs.
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             return new Response(
584 584
                 0,
585 585
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
586
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
586
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
587 587
         } else {
588 588
             // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle
589 589
             // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals)
@@ -593,20 +593,20 @@  discard block
 block discarded – undo
593 593
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
594 594
                 )
595 595
             ) {
596
-                if ($this->debug > 1) {
597
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
596
+                if ($this->debug>1) {
597
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
598 598
                 }
599 599
 
600 600
                 return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
601 601
             } else {
602 602
                 // build a Request object with data parsed from xml and add parameters in
603 603
                 $req = new Request($xmlRpcParser->_xh['method']);
604
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
604
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
605 605
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
606 606
                 }
607 607
 
608
-                if ($this->debug > 1) {
609
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
608
+                if ($this->debug>1) {
609
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
610 610
                 }
611 611
 
612 612
                 return $this->execute($req);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                 return new Response(
659 659
                     0,
660 660
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
661
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
661
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
662 662
                 );
663 663
             }
664 664
         }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
         // build string representation of function 'name'
674 674
         if (is_array($func)) {
675 675
             if (is_object($func[0])) {
676
-                $funcName = get_class($func[0]) . '->' . $func[1];
676
+                $funcName = get_class($func[0]).'->'.$func[1];
677 677
             } else {
678 678
                 $funcName = implode('::', $func);
679 679
             }
@@ -685,17 +685,17 @@  discard block
 block discarded – undo
685 685
 
686 686
         // verify that function to be invoked is in fact callable
687 687
         if (!is_callable($func)) {
688
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
688
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
689 689
             return new Response(
690 690
                 0,
691 691
                 PhpXmlRpc::$xmlrpcerr['server_error'],
692
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
692
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
693 693
             );
694 694
         }
695 695
 
696 696
         // If debug level is 3, we should catch all errors generated during processing of user function, and log them
697 697
         // as part of response
698
-        if ($this->debug > 2) {
698
+        if ($this->debug>2) {
699 699
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
700 700
         }
701 701
 
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
                     $r = call_user_func($func, $req);
710 710
                 }
711 711
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
712
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
712
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
713 713
                     if (is_a($r, 'PhpXmlRpc\Value')) {
714 714
                         $r = new Response($r);
715 715
                     } else {
716 716
                         $r = new Response(
717 717
                             0,
718 718
                             PhpXmlRpc::$xmlrpcerr['server_error'],
719
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
719
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
720 720
                         );
721 721
                     }
722 722
                 }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                         $r = call_user_func_array($func, array($methodName, $params, $this->user_data));
732 732
                         // mimic EPI behaviour: if we get an array that looks like an error, make it an error response
733 733
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
734
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
734
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
735 735
                         } else {
736 736
                             // functions using EPI api should NOT return resp objects, so make sure we encode the
737 737
                             // return type correctly
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             // proper error-response
756 756
             switch ($this->exception_handling) {
757 757
                 case 2:
758
-                    if ($this->debug > 2) {
758
+                    if ($this->debug>2) {
759 759
                         if (self::$_xmlrpcs_prev_ehandler) {
760 760
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
761 761
                         } else {
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
             // proper error-response
779 779
             switch ($this->exception_handling) {
780 780
                 case 2:
781
-                    if ($this->debug > 2) {
781
+                    if ($this->debug>2) {
782 782
                         if (self::$_xmlrpcs_prev_ehandler) {
783 783
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
784 784
                         } else {
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
             }
799 799
         }
800 800
 
801
-        if ($this->debug > 2) {
801
+        if ($this->debug>2) {
802 802
             // note: restore the error handler we found before calling the user func, even if it has been changed
803 803
             // inside the func itself
804 804
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
      */
865 865
     protected function debugmsg($string)
866 866
     {
867
-        $this->debug_info .= $string . "\n";
867
+        $this->debug_info .= $string."\n";
868 868
     }
869 869
 
870 870
     /**
@@ -874,9 +874,9 @@  discard block
 block discarded – undo
874 874
     protected function xml_header($charsetEncoding = '')
875 875
     {
876 876
         if ($charsetEncoding != '') {
877
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
877
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
878 878
         } else {
879
-            return "<?xml version=\"1.0\"?" . ">\n";
879
+            return "<?xml version=\"1.0\"?".">\n";
880 880
         }
881 881
     }
882 882
 
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                 $i++; // for error message, we count params from 1
1170 1170
                 return static::_xmlrpcs_multicall_error(new Response(0,
1171 1171
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1172
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1172
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1173 1173
             }
1174 1174
         }
1175 1175
 
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
             }
1251 1251
         } else {
1252 1252
             $numCalls = count($req);
1253
-            for ($i = 0; $i < $numCalls; $i++) {
1253
+            for ($i = 0; $i<$numCalls; $i++) {
1254 1254
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1255 1255
             }
1256 1256
         }
Please login to merge, or discard this patch.
tests/05LoggerTest.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__ . '/PolyfillTestCase.php';
3
+include_once __DIR__.'/PolyfillTestCase.php';
4 4
 
5 5
 use PhpXmlRpc\Helper\Charset;
6 6
 use PhpXmlRpc\Helper\Http;
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
         $l = $h->getLogger();
39 39
         Http::setLogger($this);
40 40
 
41
-        $s = "HTTP/1.0 200 OK\r\n" .
42
-            "Content-Type: unknown\r\n" .
43
-            "\r\n" .
41
+        $s = "HTTP/1.0 200 OK\r\n".
42
+            "Content-Type: unknown\r\n".
43
+            "\r\n".
44 44
             "body";
45 45
         ob_start();
46 46
         $h->parseResponseHeaders($s, false, 1);
Please login to merge, or discard this patch.
src/Response.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 // user declares the type of resp value: we "almost" trust it... but log errors just in case
74 74
                 if (($this->valtyp == 'xmlrpcvals' && (!is_a($this->val, 'PhpXmlRpc\Value'))) ||
75 75
                     ($this->valtyp == 'xml' && (!is_string($this->val)))) {
76
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in does not match type ' . $valType);
76
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in does not match type '.$valType);
77 77
                 }
78 78
             }
79 79
         }
@@ -152,33 +152,33 @@  discard block
 block discarded – undo
152 152
     public function serialize($charsetEncoding = '')
153 153
     {
154 154
         if ($charsetEncoding != '') {
155
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
155
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
156 156
         } else {
157 157
             $this->content_type = 'text/xml';
158 158
         }
159 159
         if (PhpXmlRpc::$xmlrpc_null_apache_encoding) {
160
-            $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n";
160
+            $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n";
161 161
         } else {
162 162
             $result = "<methodResponse>\n";
163 163
         }
164 164
         if ($this->errno) {
165 165
             // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars
166
-            $result .= "<fault>\n" .
167
-                "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
168
-                "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
169
-                $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) .
166
+            $result .= "<fault>\n".
167
+                "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno.
168
+                "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>".
169
+                $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding).
170 170
                 "</string></value>\n</member>\n</struct>\n</value>\n</fault>";
171 171
         } else {
172 172
             if (is_object($this->val) && is_a($this->val, 'PhpXmlRpc\Value')) {
173
-                $result .= "<params>\n<param>\n" . $this->val->serialize($charsetEncoding) . "</param>\n</params>";
173
+                $result .= "<params>\n<param>\n".$this->val->serialize($charsetEncoding)."</param>\n</params>";
174 174
             } else if (is_string($this->val) && $this->valtyp == 'xml') {
175
-                $result .= "<params>\n<param>\n" .
176
-                    $this->val .
175
+                $result .= "<params>\n<param>\n".
176
+                    $this->val.
177 177
                     "</param>\n</params>";
178 178
             } else if ($this->valtyp == 'phpvals') {
179 179
                     $encoder = new Encoder();
180 180
                     $val = $encoder->encode($this->val);
181
-                    $result .= "<params>\n<param>\n" . $val->serialize($charsetEncoding) . "</param>\n</params>";
181
+                    $result .= "<params>\n<param>\n".$val->serialize($charsetEncoding)."</param>\n</params>";
182 182
             } else {
183 183
                 throw new StateErrorException('cannot serialize xmlrpc response objects whose content is native php values');
184 184
             }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 return $this->httpResponse['raw_data'];
205 205
             default:
206 206
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
207
-                trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
207
+                trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
208 208
                 return null;
209 209
         }
210 210
     }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                 break;
226 226
             default:
227 227
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
228
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
228
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
229 229
         }
230 230
     }
231 231
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                 break;
260 260
             default:
261 261
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
262
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
262
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
263 263
         }
264 264
     }
265 265
 }
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     public function xml_header($charsetEncoding = '')
58 58
     {
59 59
         if ($charsetEncoding != '') {
60
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
60
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
61 61
         } else {
62
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
62
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
63 63
         }
64 64
     }
65 65
 
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     public function createPayload($charsetEncoding = '')
83 83
     {
84 84
         if ($charsetEncoding != '') {
85
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
85
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
86 86
         } else {
87 87
             $this->content_type = 'text/xml';
88 88
         }
89 89
         $this->payload = $this->xml_header($charsetEncoding);
90
-        $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities(
91
-            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
90
+        $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities(
91
+            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
92 92
         $this->payload .= "<params>\n";
93 93
         foreach ($this->params as $p) {
94
-            $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) .
94
+            $this->payload .= "<param>\n".$p->serialize($charsetEncoding).
95 95
                 "</param>\n";
96 96
         }
97 97
         $this->payload .= "</params>\n";
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
             return true;
143 143
         } else {
144
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value');
144
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value');
145 145
             return false;
146 146
         }
147 147
     }
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS)
215 215
     {
216
-        if ($this->debug > 0) {
216
+        if ($this->debug>0) {
217 217
             $this->getLogger()->debug("---GOT---\n$data\n---END---");
218 218
         }
219 219
 
220 220
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
221 221
 
222 222
         if ($data == '') {
223
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.');
223
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.');
224 224
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
225 225
         }
226 226
 
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
         if (substr($data, 0, 4) == 'HTTP') {
229 229
             $httpParser = new Http();
230 230
             try {
231
-                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0);
231
+                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0);
232 232
             } catch (HttpException $e) {
233 233
                 // failed processing of HTTP response headers
234 234
                 // save into response obj the full payload received, for debugging
235 235
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode()));
236
-            } catch(\Exception $e) {
236
+            } catch (\Exception $e) {
237 237
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data));
238 238
             }
239 239
         } else {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib
250 250
         $pos = strrpos($data, '</methodResponse>');
251 251
         if ($pos !== false) {
252
-            $data = substr($data, 0, $pos + 17);
252
+            $data = substr($data, 0, $pos+17);
253 253
         }
254 254
 
255 255
         // try to 'guestimate' the character encoding of the received response
@@ -258,21 +258,21 @@  discard block
 block discarded – undo
258 258
             $data
259 259
         );
260 260
 
261
-        if ($this->debug >= 0) {
261
+        if ($this->debug>=0) {
262 262
             $this->httpResponse = $httpResponse;
263 263
         } else {
264 264
             $httpResponse = null;
265 265
         }
266 266
 
267
-        if ($this->debug > 0) {
267
+        if ($this->debug>0) {
268 268
             $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
269 269
             if ($start) {
270 270
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
271 271
                 /// @todo what if there is no end tag?
272 272
                 $end = strpos($data, '-->', $start);
273
-                $comments = substr($data, $start, $end - $start);
274
-                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t" .
275
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding));
273
+                $comments = substr($data, $start, $end-$start);
274
+                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t".
275
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding));
276 276
             }
277 277
         }
278 278
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                     if ($respEncoding == 'ISO-8859-1') {
295 295
                         $data = utf8_encode($data);
296 296
                     } else {
297
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding);
297
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding);
298 298
                     }
299 299
                 }
300 300
             }
@@ -320,16 +320,16 @@  discard block
 block discarded – undo
320 320
             //    there could be proxies meddling with the request, or network data corruption...
321 321
 
322 322
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
323
-                PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
323
+                PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
324 324
 
325
-            if ($this->debug > 0) {
325
+            if ($this->debug>0) {
326 326
                 $this->getLogger()->debug($xmlRpcParser->_xh['isf_reason']);
327 327
             }
328 328
         }
329 329
         // second error check: xml well-formed but not xml-rpc compliant
330 330
         elseif ($xmlRpcParser->_xh['isf'] == 2) {
331 331
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
332
-                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
332
+                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
333 333
 
334 334
             /// @todo echo something for the user? check if it was already done by the parser...
335 335
             //if ($this->debug > 0) {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         }
339 339
         // third error check: parsing of the response has somehow gone boink.
340 340
         /// @todo shall we omit this check, since we trust the parsing code?
341
-        elseif ($xmlRpcParser->_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
341
+        elseif ($xmlRpcParser->_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
342 342
             // something odd has happened and it's time to generate a client side error indicating something odd went on
343 343
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
344 344
                 '', $httpResponse
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
             /// @todo echo something for the user?
348 348
         } else {
349
-            if ($this->debug > 1) {
349
+            if ($this->debug>1) {
350 350
                 $this->getLogger()->debug(
351 351
                     "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---"
352 352
                 );
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 if ($errNo == 0) {
371 371
                     // FAULT returned, errno needs to reflect that
372 372
                     /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr
373
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1');
373
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1');
374 374
                     $errNo = -1;
375 375
                 }
376 376
 
Please login to merge, or discard this patch.
tests/12ExtraFilesTest.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 'extras' directory.
Please login to merge, or discard this patch.
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.