Passed
Push — master ( 6f0f8c...d68788 )
by Gaetano
06:26
created
src/Server.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     public function getOptions()
261 261
     {
262 262
         $values = array();
263
-        foreach($this->options as $opt) {
263
+        foreach ($this->options as $opt) {
264 264
             $values[$opt] = $this->getOption($opt);
265 265
         }
266 266
         return $values;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      */
274 274
     public function setOptions($options)
275 275
     {
276
-        foreach($options as $name => $value) {
276
+        foreach ($options as $name => $value) {
277 277
             $this->setOption($name, $value);
278 278
         }
279 279
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      */
313 313
     public static function xmlrpc_debugmsg($msg)
314 314
     {
315
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
315
+        static::$_xmlrpc_debuginfo .= $msg."\n";
316 316
     }
317 317
 
318 318
     /**
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public static function error_occurred($msg)
326 326
     {
327
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
327
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
328 328
     }
329 329
 
330 330
     /**
@@ -345,10 +345,10 @@  discard block
 block discarded – undo
345 345
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
346 346
         $out = '';
347 347
         if ($this->debug_info != '') {
348
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
348
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
349 349
         }
350 350
         if (static::$_xmlrpc_debuginfo != '') {
351
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
351
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
352 352
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
353 353
             // into return payload AFTER the beginning tag
354 354
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
         $this->debug_info = '';
378 378
 
379 379
         // Save what we received, before parsing it
380
-        if ($this->debug > 1) {
381
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
380
+        if ($this->debug>1) {
381
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
382 382
         }
383 383
 
384 384
         $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -395,14 +395,14 @@  discard block
 block discarded – undo
395 395
             $resp->raw_data = $rawData;
396 396
         }
397 397
 
398
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
399
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
400
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
398
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
399
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
400
+                static::$_xmlrpcs_occurred_errors."+++END+++");
401 401
         }
402 402
 
403 403
         $payload = $this->xml_header($respCharset);
404
-        if ($this->debug > 0) {
405
-            $payload = $payload . $this->serializeDebug($respCharset);
404
+        if ($this->debug>0) {
405
+            $payload = $payload.$this->serializeDebug($respCharset);
406 406
         }
407 407
 
408 408
         // Do not create response serialization if it has already happened. Helps to build json magic
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         if (empty($resp->payload)) {
411 411
             $resp->serialize($respCharset);
412 412
         }
413
-        $payload = $payload . $resp->payload;
413
+        $payload = $payload.$resp->payload;
414 414
 
415 415
         if ($returnPayload) {
416 416
             return $payload;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         // if we get a warning/error that has output some text before here, then we cannot
420 420
         // add a new header. We cannot say we are sending xml, either...
421 421
         if (!headers_sent()) {
422
-            header('Content-Type: ' . $resp->content_type);
422
+            header('Content-Type: '.$resp->content_type);
423 423
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
424 424
             header("Vary: Accept-Charset");
425 425
 
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
443 443
             // responses up to 8000 bytes
444 444
             if ($phpNoSelfCompress) {
445
-                header('Content-Length: ' . (int)strlen($payload));
445
+                header('Content-Length: '.(int) strlen($payload));
446 446
             }
447 447
         } else {
448
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
448
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
449 449
         }
450 450
 
451 451
         print $payload;
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
             $numParams = count($in);
509 509
         }
510 510
         foreach ($sigs as $curSig) {
511
-            if (count($curSig) == $numParams + 1) {
511
+            if (count($curSig) == $numParams+1) {
512 512
                 $itsOK = 1;
513
-                for ($n = 0; $n < $numParams; $n++) {
513
+                for ($n = 0; $n<$numParams; $n++) {
514 514
                     if (is_object($in)) {
515 515
                         $p = $in->getParam($n);
516 516
                         if ($p->kindOf() == 'scalar') {
@@ -523,10 +523,10 @@  discard block
 block discarded – undo
523 523
                     }
524 524
 
525 525
                     // param index is $n+1, as first member of sig is return type
526
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
526
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
527 527
                         $itsOK = 0;
528
-                        $pno = $n + 1;
529
-                        $wanted = $curSig[$n + 1];
528
+                        $pno = $n+1;
529
+                        $wanted = $curSig[$n+1];
530 530
                         $got = $pt;
531 531
                         break;
532 532
                     }
@@ -553,10 +553,10 @@  discard block
 block discarded – undo
553 553
         // check if $_SERVER is populated: it might have been disabled via ini file
554 554
         // (this is true even when in CLI mode)
555 555
         if (count($_SERVER) == 0) {
556
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
556
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
557 557
         }
558 558
 
559
-        if ($this->debug > 1) {
559
+        if ($this->debug>1) {
560 560
             if (function_exists('getallheaders')) {
561 561
                 $this->debugmsg(''); // empty line
562 562
                 foreach (getallheaders() as $name => $val) {
@@ -581,13 +581,13 @@  discard block
 block discarded – undo
581 581
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
582 582
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
583 583
                         $data = $degzdata;
584
-                        if ($this->debug > 1) {
585
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
584
+                        if ($this->debug>1) {
585
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
586 586
                         }
587 587
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
588 588
                         $data = $degzdata;
589
-                        if ($this->debug > 1) {
590
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
589
+                        if ($this->debug>1) {
590
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
591 591
                         }
592 592
                     } else {
593 593
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                     if ($reqEncoding == 'ISO-8859-1') {
675 675
                         $data = utf8_encode($data);
676 676
                     } else {
677
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding);
677
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding);
678 678
                     }
679 679
                 }
680 680
             }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
702 702
             return new Response(
703 703
                 0,
704
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
704
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
705 705
                 $xmlRpcParser->_xh['isf_reason']);
706 706
         } elseif ($xmlRpcParser->_xh['isf']) {
707 707
             /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs.
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
             return new Response(
710 710
                 0,
711 711
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
712
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
712
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
713 713
         } else {
714 714
             // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle
715 715
             // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals)
@@ -719,20 +719,20 @@  discard block
 block discarded – undo
719 719
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
720 720
                 )
721 721
             ) {
722
-                if ($this->debug > 1) {
723
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
722
+                if ($this->debug>1) {
723
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
724 724
                 }
725 725
 
726 726
                 return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
727 727
             } else {
728 728
                 // build a Request object with data parsed from xml and add parameters in
729 729
                 $req = new Request($xmlRpcParser->_xh['method']);
730
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
730
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
731 731
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
732 732
                 }
733 733
 
734
-                if ($this->debug > 1) {
735
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
734
+                if ($this->debug>1) {
735
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
736 736
                 }
737 737
 
738 738
                 return $this->execute($req);
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
                 return new Response(
785 785
                     0,
786 786
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
787
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
787
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
788 788
                 );
789 789
             }
790 790
         }
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
         // build string representation of function 'name'
800 800
         if (is_array($func)) {
801 801
             if (is_object($func[0])) {
802
-                $funcName = get_class($func[0]) . '->' . $func[1];
802
+                $funcName = get_class($func[0]).'->'.$func[1];
803 803
             } else {
804 804
                 $funcName = implode('::', $func);
805 805
             }
@@ -811,23 +811,23 @@  discard block
 block discarded – undo
811 811
 
812 812
         // verify that function to be invoked is in fact callable
813 813
         if (!is_callable($func)) {
814
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
814
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
815 815
             return new Response(
816 816
                 0,
817 817
                 PhpXmlRpc::$xmlrpcerr['server_error'],
818
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
818
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
819 819
             );
820 820
         }
821 821
 
822 822
         if (isset($dmap[$methodName]['exception_handling'])) {
823
-            $exception_handling = (int)$dmap[$methodName]['exception_handling'];
823
+            $exception_handling = (int) $dmap[$methodName]['exception_handling'];
824 824
         } else {
825 825
             $exception_handling = $this->exception_handling;
826 826
         }
827 827
 
828 828
         // If debug level is 3, we should catch all errors generated during processing of user function, and log them
829 829
         // as part of response
830
-        if ($this->debug > 2) {
830
+        if ($this->debug>2) {
831 831
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
832 832
         }
833 833
 
@@ -841,14 +841,14 @@  discard block
 block discarded – undo
841 841
                     $r = call_user_func($func, $req);
842 842
                 }
843 843
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
844
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
844
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
845 845
                     if (is_a($r, 'PhpXmlRpc\Value')) {
846 846
                         $r = new Response($r);
847 847
                     } else {
848 848
                         $r = new Response(
849 849
                             0,
850 850
                             PhpXmlRpc::$xmlrpcerr['server_error'],
851
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
851
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
852 852
                         );
853 853
                     }
854 854
                 }
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
                         $r = call_user_func_array($func, array($methodName, $params, $this->user_data));
864 864
                         // mimic EPI behaviour: if we get an array that looks like an error, make it an error response
865 865
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
866
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
866
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
867 867
                         } else {
868 868
                             // functions using EPI api should NOT return resp objects, so make sure we encode the
869 869
                             // return type correctly
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
             // proper error-response
889 889
             switch ($exception_handling) {
890 890
                 case 2:
891
-                    if ($this->debug > 2) {
891
+                    if ($this->debug>2) {
892 892
                         if (self::$_xmlrpcs_prev_ehandler) {
893 893
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
894 894
                         } else {
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
             // proper error-response
912 912
             switch ($exception_handling) {
913 913
                 case 2:
914
-                    if ($this->debug > 2) {
914
+                    if ($this->debug>2) {
915 915
                         if (self::$_xmlrpcs_prev_ehandler) {
916 916
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
917 917
                         } else {
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
             }
932 932
         }
933 933
 
934
-        if ($this->debug > 2) {
934
+        if ($this->debug>2) {
935 935
             // note: restore the error handler we found before calling the user func, even if it has been changed
936 936
             // inside the func itself
937 937
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
      */
998 998
     protected function debugmsg($string)
999 999
     {
1000
-        $this->debug_info .= $string . "\n";
1000
+        $this->debug_info .= $string."\n";
1001 1001
     }
1002 1002
 
1003 1003
     /**
@@ -1007,9 +1007,9 @@  discard block
 block discarded – undo
1007 1007
     protected function xml_header($charsetEncoding = '')
1008 1008
     {
1009 1009
         if ($charsetEncoding != '') {
1010
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
1010
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
1011 1011
         } else {
1012
-            return "<?xml version=\"1.0\"?" . ">\n";
1012
+            return "<?xml version=\"1.0\"?".">\n";
1013 1013
         }
1014 1014
     }
1015 1015
 
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
                 $i++; // for error message, we count params from 1
1303 1303
                 return static::_xmlrpcs_multicall_error(new Response(0,
1304 1304
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1305
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1305
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1306 1306
             }
1307 1307
         }
1308 1308
 
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
             }
1384 1384
         } else {
1385 1385
             $numCalls = count($req);
1386
-            for ($i = 0; $i < $numCalls; $i++) {
1386
+            for ($i = 0; $i<$numCalls; $i++) {
1387 1387
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1388 1388
             }
1389 1389
         }
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
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                     $this->me['struct'] = $val;
97 97
                     break;
98 98
                 default:
99
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
99
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)");
100 100
             }
101 101
         }
102 102
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         if ($typeOf !== 1) {
129
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
129
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
130 130
             return 0;
131 131
         }
132 132
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 
144 144
         switch ($this->mytype) {
145 145
             case 1:
146
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
146
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
147 147
                 return 0;
148 148
             case 3:
149
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
149
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
150 150
                 return 0;
151 151
             case 2:
152 152
                 // we're adding a scalar value to an array here
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
             return 1;
192 192
         } else {
193
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
193
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
194 194
             return 0;
195 195
         }
196 196
     }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
             return 1;
223 223
         } else {
224
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
224
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
225 225
             return 0;
226 226
         }
227 227
     }
@@ -265,19 +265,19 @@  discard block
 block discarded – undo
265 265
             case 1:
266 266
                 switch ($typ) {
267 267
                     case static::$xmlrpcBase64:
268
-                        $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
268
+                        $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>";
269 269
                         break;
270 270
                     case static::$xmlrpcBoolean:
271
-                        $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
271
+                        $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>";
272 272
                         break;
273 273
                     case static::$xmlrpcString:
274 274
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
275
-                        $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>";
275
+                        $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>";
276 276
                         break;
277 277
                     case static::$xmlrpcInt:
278 278
                     case static::$xmlrpcI4:
279 279
                     case static::$xmlrpcI8:
280
-                        $rs .= "<{$typ}>" . (int)$val . "</{$typ}>";
280
+                        $rs .= "<{$typ}>".(int) $val."</{$typ}>";
281 281
                         break;
282 282
                     case static::$xmlrpcDouble:
283 283
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -285,16 +285,16 @@  discard block
 block discarded – undo
285 285
                         // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14.
286 286
                         // The code below tries its best at keeping max precision while avoiding exp notation,
287 287
                         // but there is of course no limit in the number of decimal places to be used...
288
-                        $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>";
288
+                        $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>";
289 289
                         break;
290 290
                     case static::$xmlrpcDateTime:
291 291
                         if (is_string($val)) {
292 292
                             $rs .= "<{$typ}>{$val}</{$typ}>";
293 293
                         // DateTimeInterface is not present in php 5.4...
294 294
                         } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) {
295
-                            $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>";
295
+                            $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>";
296 296
                         } elseif (is_int($val)) {
297
-                            $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>";
297
+                            $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>";
298 298
                         } else {
299 299
                             // not really a good idea here: but what should we output anyway? left for backward compat...
300 300
                             $rs .= "<{$typ}>{$val}</{$typ}>";
@@ -316,14 +316,14 @@  discard block
 block discarded – undo
316 316
             case 3:
317 317
                 // struct
318 318
                 if ($this->_php_class) {
319
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
319
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
320 320
                 } else {
321 321
                     $rs .= "<struct>\n";
322 322
                 }
323 323
                 $charsetEncoder = $this->getCharsetEncoder();
324 324
                 /** @var Value $val2 */
325 325
                 foreach ($val as $key2 => $val2) {
326
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
326
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
327 327
                     //$rs.=$this->serializeval($val2);
328 328
                     $rs .= $val2->serialize($charsetEncoding);
329 329
                     $rs .= "</member>\n";
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         $val = reset($this->me);
359 359
         $typ = key($this->me);
360 360
 
361
-        return '<value>' . $this->serializeData($typ, $val, $charsetEncoding) . "</value>\n";
361
+        return '<value>'.$this->serializeData($typ, $val, $charsetEncoding)."</value>\n";
362 362
     }
363 363
 
364 364
     /**
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
             $server = $parts['host'];
355 355
             $path = isset($parts['path']) ? $parts['path'] : '';
356 356
             if (isset($parts['query'])) {
357
-                $path .= '?' . $parts['query'];
357
+                $path .= '?'.$parts['query'];
358 358
             }
359 359
             if (isset($parts['fragment'])) {
360
-                $path .= '#' . $parts['fragment'];
360
+                $path .= '#'.$parts['fragment'];
361 361
             }
362 362
             if (isset($parts['port'])) {
363 363
                 $port = $parts['port'];
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             }
374 374
         }
375 375
         if ($path == '' || $path[0] != '/') {
376
-            $this->path = '/' . $path;
376
+            $this->path = '/'.$path;
377 377
         } else {
378 378
             $this->path = $path;
379 379
         }
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         //$this->accepted_charset_encodings = $ch->knownCharsets();
406 406
 
407 407
         // initialize user_agent string
408
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
408
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
409 409
     }
410 410
 
411 411
     /**
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     public function getOptions()
595 595
     {
596 596
         $values = array();
597
-        foreach($this->options as $opt) {
597
+        foreach ($this->options as $opt) {
598 598
             $values[$opt] = $this->getOption($opt);
599 599
         }
600 600
         return $values;
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
      */
608 608
     public function setOptions($options)
609 609
     {
610
-        foreach($options as $name => $value) {
610
+        foreach ($options as $name => $value) {
611 611
             $this->setOption($name, $value);
612 612
         }
613 613
 
@@ -903,12 +903,12 @@  discard block
 block discarded – undo
903 903
      */
904 904
     public function getUrl()
905 905
     {
906
-        $url = $this->method . '://' . $this->server;
906
+        $url = $this->method.'://'.$this->server;
907 907
         if (($this->port = 80 && in_array($this->method, array('http', 'http10', 'http11', 'h2c'))) &&
908 908
             ($this->port = 443 && in_array($this->method, array('https', 'h2')))) {
909
-            return $url . $this->path;
909
+            return $url.$this->path;
910 910
         } else {
911
-            return $url . ':' . $this->port . $this->path;
911
+            return $url.':'.$this->port.$this->path;
912 912
         }
913 913
     }
914 914
 
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
      */
1054 1054
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
1055 1055
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
1056
-        $method='http')
1056
+        $method = 'http')
1057 1057
     {
1058 1058
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
1059 1059
 
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
      * @param int $sslVersion
1087 1087
      * @return Response
1088 1088
      */
1089
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
1089
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
1090 1090
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
1091 1091
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
1092 1092
         $sslVersion = 0)
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
      */
1126 1126
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
1127 1127
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
1128
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
1128
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
1129 1129
         $sslVersion = 0)
1130 1130
     {
1131 1131
         /// @todo log a warning if passed an unsupported method
@@ -1158,16 +1158,16 @@  discard block
 block discarded – undo
1158 1158
         // thanks to Grant Rauscher <[email protected]> for this
1159 1159
         $credentials = '';
1160 1160
         if ($username != '') {
1161
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
1161
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
1162 1162
             if ($authType != 1) {
1163 1163
                 /// @todo make this a proper error, i.e. return a failure
1164
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
1164
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
1165 1165
             }
1166 1166
         }
1167 1167
 
1168 1168
         $acceptedEncoding = '';
1169 1169
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
1170
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
1170
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
1171 1171
         }
1172 1172
 
1173 1173
         if ($port == 0) {
@@ -1183,13 +1183,13 @@  discard block
 block discarded – undo
1183 1183
             $connectPort = $proxyPort;
1184 1184
             $transport = 'tcp';
1185 1185
             /// @todo check: should we not use https in some cases?
1186
-            $uri = 'http://' . $server . ':' . $port . $this->path;
1186
+            $uri = 'http://'.$server.':'.$port.$this->path;
1187 1187
             if ($proxyUsername != '') {
1188 1188
                 if ($proxyAuthType != 1) {
1189 1189
                     /// @todo make this a proper error, i.e. return a failure
1190
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
1190
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
1191 1191
                 }
1192
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
1192
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
1193 1193
             }
1194 1194
         } else {
1195 1195
             $connectServer = $server;
@@ -1204,32 +1204,32 @@  discard block
 block discarded – undo
1204 1204
             $version = '';
1205 1205
             foreach ($this->cookies as $name => $cookie) {
1206 1206
                 /// @todo should we sanitize the cookie name/value on behalf of the user?
1207
-                $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
1207
+                $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
1208 1208
             }
1209
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
1209
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
1210 1210
         }
1211 1211
 
1212 1212
         // omit port if default
1213 1213
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
1214
-            $port =  '';
1214
+            $port = '';
1215 1215
         } else {
1216
-            $port = ':' . $port;
1216
+            $port = ':'.$port;
1217 1217
         }
1218 1218
 
1219
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
1220
-            'User-Agent: ' . $this->user_agent . "\r\n" .
1221
-            'Host: ' . $server . $port . "\r\n" .
1222
-            $credentials .
1223
-            $proxyCredentials .
1224
-            $acceptedEncoding .
1225
-            $encodingHdr .
1226
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
1227
-            $cookieHeader .
1228
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
1229
-            strlen($payload) . "\r\n\r\n" .
1219
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
1220
+            'User-Agent: '.$this->user_agent."\r\n".
1221
+            'Host: '.$server.$port."\r\n".
1222
+            $credentials.
1223
+            $proxyCredentials.
1224
+            $acceptedEncoding.
1225
+            $encodingHdr.
1226
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
1227
+            $cookieHeader.
1228
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
1229
+            strlen($payload)."\r\n\r\n".
1230 1230
             $payload;
1231 1231
 
1232
-        if ($this->debug > 1) {
1232
+        if ($this->debug>1) {
1233 1233
             $this->getLogger()->debug("---SENDING---\n$op\n---END---");
1234 1234
         }
1235 1235
 
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 
1257 1257
         $context = stream_context_create($contextOptions);
1258 1258
 
1259
-        if ($timeout <= 0) {
1259
+        if ($timeout<=0) {
1260 1260
             $connectTimeout = ini_get('default_socket_timeout');
1261 1261
         } else {
1262 1262
             $connectTimeout = $timeout;
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
1269 1269
             STREAM_CLIENT_CONNECT, $context);
1270 1270
         if ($fp) {
1271
-            if ($timeout > 0) {
1271
+            if ($timeout>0) {
1272 1272
                 stream_set_timeout($fp, $timeout, 0);
1273 1273
             }
1274 1274
         } else {
@@ -1277,8 +1277,8 @@  discard block
 block discarded – undo
1277 1277
                 $this->errstr = $err['message'];
1278 1278
             }
1279 1279
 
1280
-            $this->errstr = 'Connect error: ' . $this->errstr;
1281
-            $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
1280
+            $this->errstr = 'Connect error: '.$this->errstr;
1281
+            $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
1282 1282
 
1283 1283
             return $r;
1284 1284
         }
@@ -1366,18 +1366,18 @@  discard block
 block discarded – undo
1366 1366
             $keyPass, $sslVersion);
1367 1367
 
1368 1368
         if (!$curl) {
1369
-            return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details');
1369
+            return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details');
1370 1370
         }
1371 1371
 
1372 1372
         $result = curl_exec($curl);
1373 1373
 
1374
-        if ($this->debug > 1) {
1374
+        if ($this->debug>1) {
1375 1375
             $message = "---CURL INFO---\n";
1376 1376
             foreach (curl_getinfo($curl) as $name => $val) {
1377 1377
                 if (is_array($val)) {
1378 1378
                     $val = implode("\n", $val);
1379 1379
                 }
1380
-                $message .= $name . ': ' . $val . "\n";
1380
+                $message .= $name.': '.$val."\n";
1381 1381
             }
1382 1382
             $message .= '---END---';
1383 1383
             $this->getLogger()->debug($message);
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
             /// @todo we should use a better check here - what if we get back '' or '0'?
1388 1388
 
1389 1389
             $this->errstr = 'no response';
1390
-            $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
1390
+            $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
1391 1391
             curl_close($curl);
1392 1392
             if ($keepAlive) {
1393 1393
                 $this->xmlrpc_curl_handle = null;
@@ -1457,12 +1457,12 @@  discard block
 block discarded – undo
1457 1457
                     // http, https
1458 1458
                     $protocol = $method;
1459 1459
                     if (strpos($protocol, ':') !== false) {
1460
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1460
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1461 1461
                         return false;
1462 1462
                     }
1463 1463
                 }
1464 1464
             }
1465
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
1465
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
1466 1466
             if (!$curl) {
1467 1467
                 return false;
1468 1468
             }
@@ -1476,7 +1476,7 @@  discard block
 block discarded – undo
1476 1476
         // results into variable
1477 1477
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1478 1478
 
1479
-        if ($this->debug > 1) {
1479
+        if ($this->debug>1) {
1480 1480
             curl_setopt($curl, CURLOPT_VERBOSE, true);
1481 1481
             /// @todo redirect curlopt_stderr to some stream which can be piped to the logger
1482 1482
         }
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
             }
1502 1502
         }
1503 1503
         // extra headers
1504
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
1504
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
1505 1505
         // if no keepalive is wanted, let the server know it in advance
1506 1506
         if (!$keepAlive) {
1507 1507
             $headers[] = 'Connection: close';
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1519 1519
         // timeout is borked
1520 1520
         if ($timeout) {
1521
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
1521
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
1522 1522
         }
1523 1523
 
1524 1524
         switch ($method) {
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
                     curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
1534 1534
                 } else {
1535 1535
                     /// @todo make this a proper error, i.e. return a failure
1536
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install');
1536
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install');
1537 1537
                 }
1538 1538
                 break;
1539 1539
             case 'h2':
@@ -1542,12 +1542,12 @@  discard block
 block discarded – undo
1542 1542
         }
1543 1543
 
1544 1544
         if ($username && $password) {
1545
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
1545
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
1546 1546
             if (defined('CURLOPT_HTTPAUTH')) {
1547 1547
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
1548 1548
             } elseif ($authType != 1) {
1549 1549
                 /// @todo make this a proper error, i.e. return a failure
1550
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
1550
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
1551 1551
             }
1552 1552
         }
1553 1553
 
@@ -1590,14 +1590,14 @@  discard block
 block discarded – undo
1590 1590
             if ($proxyPort == 0) {
1591 1591
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1592 1592
             }
1593
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1593
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1594 1594
             if ($proxyUsername) {
1595
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1595
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1596 1596
                 if (defined('CURLOPT_PROXYAUTH')) {
1597 1597
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1598 1598
                 } elseif ($proxyAuthType != 1) {
1599 1599
                     /// @todo make this a proper error, i.e. return a failure
1600
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1600
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1601 1601
                 }
1602 1602
             }
1603 1603
         }
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
         if (count($this->cookies)) {
1608 1608
             $cookieHeader = '';
1609 1609
             foreach ($this->cookies as $name => $cookie) {
1610
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1610
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1611 1611
             }
1612 1612
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1613 1613
         }
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
             curl_setopt($curl, $opt, $val);
1617 1617
         }
1618 1618
 
1619
-        if ($this->debug > 1) {
1619
+        if ($this->debug>1) {
1620 1620
             $this->getLogger()->debug("---SENDING---\n$payload\n---END---");
1621 1621
         }
1622 1622
 
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
             $call['methodName'] = new Value($req->method(), 'string');
1708 1708
             $numParams = $req->getNumParams();
1709 1709
             $params = array();
1710
-            for ($i = 0; $i < $numParams; $i++) {
1710
+            for ($i = 0; $i<$numParams; $i++) {
1711 1711
                 $params[$i] = $req->getParam($i);
1712 1712
             }
1713 1713
             $call['params'] = new Value($params, 'array');
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
         $response = array();
1730 1730
 
1731 1731
         if ($this->return_type == 'xml') {
1732
-            for ($i = 0; $i < count($reqs); $i++) {
1732
+            for ($i = 0; $i<count($reqs); $i++) {
1733 1733
                 $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse());
1734 1734
             }
1735 1735
 
@@ -1737,21 +1737,21 @@  discard block
 block discarded – undo
1737 1737
             if (!is_array($rets)) {
1738 1738
                 // bad return type from system.multicall
1739 1739
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1740
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse());
1740
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse());
1741 1741
             }
1742 1742
             $numRets = count($rets);
1743 1743
             if ($numRets != count($reqs)) {
1744 1744
                 // wrong number of return values.
1745 1745
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1746
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals',
1746
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals',
1747 1747
                     $result->httpResponse());
1748 1748
             }
1749 1749
 
1750
-            for ($i = 0; $i < $numRets; $i++) {
1750
+            for ($i = 0; $i<$numRets; $i++) {
1751 1751
                 $val = $rets[$i];
1752 1752
                 if (!is_array($val)) {
1753 1753
                     return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1754
-                        PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct",
1754
+                        PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct",
1755 1755
                         'phpvals', $result->httpResponse());
1756 1756
                 }
1757 1757
                 switch (count($val)) {
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
                         if (!isset($val[0])) {
1760 1760
                             // Bad value
1761 1761
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1762
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value",
1762
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value",
1763 1763
                                 'phpvals', $result->httpResponse());
1764 1764
                         }
1765 1765
                         // Normal return value
@@ -1771,20 +1771,20 @@  discard block
 block discarded – undo
1771 1771
                         if (!is_int($code)) {
1772 1772
                             /// @todo should we check that it is != 0?
1773 1773
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1774
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1774
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1775 1775
                                 'phpvals', $result->httpResponse());
1776 1776
                         }
1777 1777
                         $str = @$val['faultString'];
1778 1778
                         if (!is_string($str)) {
1779 1779
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1780
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString",
1780
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString",
1781 1781
                                 'phpvals', $result->httpResponse());
1782 1782
                         }
1783 1783
                         $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse());
1784 1784
                         break;
1785 1785
                     default:
1786 1786
                         return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1787
-                            PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1787
+                            PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1788 1788
                             'phpvals', $result->httpResponse());
1789 1789
                 }
1790 1790
             }
@@ -1793,14 +1793,14 @@  discard block
 block discarded – undo
1793 1793
             // return type == 'xmlrpcvals'
1794 1794
             if ($rets->kindOf() != 'array') {
1795 1795
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1796
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals',
1796
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals',
1797 1797
                     $result->httpResponse());
1798 1798
             }
1799 1799
             $numRets = $rets->count();
1800 1800
             if ($numRets != count($reqs)) {
1801 1801
                 // wrong number of return values.
1802 1802
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1803
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals',
1803
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals',
1804 1804
                     $result->httpResponse());
1805 1805
             }
1806 1806
 
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
                     case 'array':
1810 1810
                         if ($val->count() != 1) {
1811 1811
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1812
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1812
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1813 1813
                                 'phpvals', $result->httpResponse());
1814 1814
                         }
1815 1815
                         // Normal return value
@@ -1818,28 +1818,28 @@  discard block
 block discarded – undo
1818 1818
                     case 'struct':
1819 1819
                         if ($val->count() != 2) {
1820 1820
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1821
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1821
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1822 1822
                                 'phpvals', $result->httpResponse());
1823 1823
                         }
1824 1824
                         /** @var Value $code */
1825 1825
                         $code = $val['faultCode'];
1826 1826
                         if ($code->kindOf() != 'scalar' || $code->scalarTyp() != 'int') {
1827 1827
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1828
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1828
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1829 1829
                                 'xmlrpcvals', $result->httpResponse());
1830 1830
                         }
1831 1831
                         /** @var Value $str */
1832 1832
                         $str = $val['faultString'];
1833 1833
                         if ($str->kindOf() != 'scalar' || $str->scalarTyp() != 'string') {
1834 1834
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1835
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1835
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1836 1836
                                 'xmlrpcvals', $result->httpResponse());
1837 1837
                         }
1838 1838
                         $response[] = new Response(0, $code->scalarVal(), $str->scalarVal(), 'xmlrpcvals', $result->httpResponse());
1839 1839
                         break;
1840 1840
                     default:
1841 1841
                         return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1842
-                            PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct",
1842
+                            PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct",
1843 1843
                             'xmlrpcvals', $result->httpResponse());
1844 1844
                 }
1845 1845
             }
Please login to merge, or discard this patch.