Passed
Push — master ( 14eb2f...4b184a )
by Gaetano
08:28
created
demo/server/methodProviders/wrapper.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 {
28 28
     global $stateNames;
29 29
 
30
-    if (isset($stateNames[$stateNo - 1])) {
31
-        return $stateNames[$stateNo - 1];
30
+    if (isset($stateNames[$stateNo-1])) {
31
+        return $stateNames[$stateNo-1];
32 32
     } else {
33 33
         // not, there so complain
34
-        throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
34
+        throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
35 35
     }
36 36
 }
37 37
 
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 
126 126
 $findstate10_sig = array(
127 127
     /// @todo add a demo/test with a closure
128
-    "function" => function ($req) { return findState($req); },
128
+    "function" => function($req) { return findState($req); },
129 129
     "signature" => array(array(Value::$xmlrpcString, Value::$xmlrpcInt)),
130
-    "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the ' .
130
+    "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the '.
131 131
         'index of that state name in an alphabetic order.',
132 132
 );
133 133
 
134
-$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return plain_findstate($stateNo); });
134
+$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return plain_findstate($stateNo); });
135 135
 
136 136
 /// @todo do we really need a new instance ?
137 137
 $c = new xmlrpcServerMethodsContainer();
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 $namespaceSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'namespacetest.', 'replace_class_name' => true, 'method_filter' => '/^findState$/', 'method_type' => 'static'));
142 142
 
143
-$returnObj_sig =  $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
143
+$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
144 144
 
145 145
 return array_merge(
146 146
     array(
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public static function xmlrpc_debugmsg($msg)
205 205
     {
206
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
206
+        static::$_xmlrpc_debuginfo .= $msg."\n";
207 207
     }
208 208
 
209 209
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public static function error_occurred($msg)
217 217
     {
218
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
218
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
219 219
     }
220 220
 
221 221
     /**
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
235 235
         $out = '';
236 236
         if ($this->debug_info != '') {
237
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
237
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
238 238
         }
239 239
         if (static::$_xmlrpc_debuginfo != '') {
240
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
240
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
241 241
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
242 242
             // into return payload AFTER the beginning tag
243 243
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
         $this->debug_info = '';
268 268
 
269 269
         // Save what we received, before parsing it
270
-        if ($this->debug > 1) {
271
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
270
+        if ($this->debug>1) {
271
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
272 272
         }
273 273
 
274 274
         $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -282,21 +282,21 @@  discard block
 block discarded – undo
282 282
             $r->raw_data = $rawData;
283 283
         }
284 284
 
285
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) {
286
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
287
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
285
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) {
286
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
287
+                static::$_xmlrpcs_occurred_errors."+++END+++");
288 288
         }
289 289
 
290 290
         $payload = $this->xml_header($respCharset);
291
-        if ($this->debug > 0) {
292
-            $payload = $payload . $this->serializeDebug($respCharset);
291
+        if ($this->debug>0) {
292
+            $payload = $payload.$this->serializeDebug($respCharset);
293 293
         }
294 294
 
295 295
         // Do not create response serialization if it has already happened. Helps building json magic
296 296
         if (empty($r->payload)) {
297 297
             $r->serialize($respCharset);
298 298
         }
299
-        $payload = $payload . $r->payload;
299
+        $payload = $payload.$r->payload;
300 300
 
301 301
         if ($returnPayload) {
302 302
             return $payload;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         // if we get a warning/error that has output some text before here, then we cannot
306 306
         // add a new header. We cannot say we are sending xml, either...
307 307
         if (!headers_sent()) {
308
-            header('Content-Type: ' . $r->content_type);
308
+            header('Content-Type: '.$r->content_type);
309 309
             // we do not know if client actually told us an accepted charset, but if he did
310 310
             // we have to tell him what we did
311 311
             header("Vary: Accept-Charset");
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
335 335
             // responses up to 8000 bytes
336 336
             if ($phpNoSelfCompress) {
337
-                header('Content-Length: ' . (int)strlen($payload));
337
+                header('Content-Length: '.(int) strlen($payload));
338 338
             }
339 339
         } else {
340
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
340
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
341 341
         }
342 342
 
343 343
         print $payload;
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
             $numParams = count($in);
393 393
         }
394 394
         foreach ($sigs as $curSig) {
395
-            if (count($curSig) == $numParams + 1) {
395
+            if (count($curSig) == $numParams+1) {
396 396
                 $itsOK = 1;
397
-                for ($n = 0; $n < $numParams; $n++) {
397
+                for ($n = 0; $n<$numParams; $n++) {
398 398
                     if (is_object($in)) {
399 399
                         $p = $in->getParam($n);
400 400
                         if ($p->kindOf() == 'scalar') {
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
                     }
408 408
 
409 409
                     // param index is $n+1, as first member of sig is return type
410
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
410
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
411 411
                         $itsOK = 0;
412
-                        $pno = $n + 1;
413
-                        $wanted = $curSig[$n + 1];
412
+                        $pno = $n+1;
413
+                        $wanted = $curSig[$n+1];
414 414
                         $got = $pt;
415 415
                         break;
416 416
                     }
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
         // check if $_SERVER is populated: it might have been disabled via ini file
438 438
         // (this is true even when in CLI mode)
439 439
         if (count($_SERVER) == 0) {
440
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
440
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
441 441
         }
442 442
 
443
-        if ($this->debug > 1) {
443
+        if ($this->debug>1) {
444 444
             if (function_exists('getallheaders')) {
445 445
                 $this->debugmsg(''); // empty line
446 446
                 foreach (getallheaders() as $name => $val) {
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
465 465
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
466 466
                         $data = $degzdata;
467
-                        if ($this->debug > 1) {
468
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
467
+                        if ($this->debug>1) {
468
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
469 469
                         }
470 470
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
471 471
                         $data = $degzdata;
472
-                        if ($this->debug > 1) {
473
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
472
+                        if ($this->debug>1) {
473
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
474 474
                         }
475 475
                     } else {
476 476
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                     if (extension_loaded('mbstring')) {
565 565
                         $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding);
566 566
                     } else {
567
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding);
567
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding);
568 568
                     }
569 569
                 }
570 570
             }
@@ -583,16 +583,16 @@  discard block
 block discarded – undo
583 583
 
584 584
         $xmlRpcParser = $this->getParser();
585 585
         $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST, $options);
586
-        if ($xmlRpcParser->_xh['isf'] > 2) {
586
+        if ($xmlRpcParser->_xh['isf']>2) {
587 587
             // (BC) we return XML error as a faultCode
588 588
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
589 589
             $r = new Response(0,
590
-                PhpXmlRpc::$xmlrpcerrxml + $matches[1],
590
+                PhpXmlRpc::$xmlrpcerrxml+$matches[1],
591 591
                 $xmlRpcParser->_xh['isf_reason']);
592 592
         } elseif ($xmlRpcParser->_xh['isf']) {
593 593
             $r = new Response(0,
594 594
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
595
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
595
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
596 596
         } else {
597 597
             // small layering violation in favor of speed and memory usage:
598 598
             // we should allow the 'execute' method handle this, but in the
@@ -603,20 +603,20 @@  discard block
 block discarded – undo
603 603
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
604 604
                 )
605 605
             ) {
606
-                if ($this->debug > 1) {
607
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
606
+                if ($this->debug>1) {
607
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
608 608
                 }
609 609
                 $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
610 610
             } else {
611 611
                 // build a Request object with data parsed from xml
612 612
                 $req = new Request($xmlRpcParser->_xh['method']);
613 613
                 // now add parameters in
614
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
614
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
615 615
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
616 616
                 }
617 617
 
618
-                if ($this->debug > 1) {
619
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
618
+                if ($this->debug>1) {
619
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
620 620
                 }
621 621
                 $r = $this->execute($req);
622 622
             }
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
                 return new Response(
670 670
                     0,
671 671
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
672
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}"
672
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}"
673 673
                 );
674 674
             }
675 675
         }
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 
683 683
         if (is_array($func)) {
684 684
             if (is_object($func[0])) {
685
-                $funcName = get_class($func[0]) . '->' . $func[1];
685
+                $funcName = get_class($func[0]).'->'.$func[1];
686 686
             } else {
687 687
                 $funcName = implode('::', $func);
688 688
             }
@@ -694,17 +694,17 @@  discard block
 block discarded – undo
694 694
 
695 695
         // verify that function to be invoked is in fact callable
696 696
         if (!is_callable($func)) {
697
-            $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
697
+            $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
698 698
             return new Response(
699 699
                 0,
700 700
                 PhpXmlRpc::$xmlrpcerr['server_error'],
701
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
701
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
702 702
             );
703 703
         }
704 704
 
705 705
         // If debug level is 3, we should catch all errors generated during
706 706
         // processing of user function, and log them as part of response
707
-        if ($this->debug > 2) {
707
+        if ($this->debug>2) {
708 708
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
709 709
         }
710 710
 
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
                     $r = call_user_func($func, $req);
718 718
                 }
719 719
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
720
-                    $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
720
+                    $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
721 721
                     if (is_a($r, 'PhpXmlRpc\Value')) {
722 722
                         $r = new Response($r);
723 723
                     } else {
724 724
                         $r = new Response(
725 725
                             0,
726 726
                             PhpXmlRpc::$xmlrpcerr['server_error'],
727
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
727
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
728 728
                         );
729 729
                     }
730 730
                 }
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
                         // mimic EPI behaviour: if we get an array that looks like an error, make it
741 741
                         // an error response
742 742
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
743
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
743
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
744 744
                         } else {
745 745
                             // functions using EPI api should NOT return resp objects,
746 746
                             // so make sure we encode the return type correctly
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
             // in the called function, we wrap it in a proper error-response
765 765
             switch ($this->exception_handling) {
766 766
                 case 2:
767
-                    if ($this->debug > 2) {
767
+                    if ($this->debug>2) {
768 768
                         if (self::$_xmlrpcs_prev_ehandler) {
769 769
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
770 770
                         } else {
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
                     $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']);
780 780
             }
781 781
         }
782
-        if ($this->debug > 2) {
782
+        if ($this->debug>2) {
783 783
             // note: restore the error handler we found before calling the
784 784
             // user func, even if it has been changed inside the func itself
785 785
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
      */
800 800
     protected function debugmsg($string)
801 801
     {
802
-        $this->debug_info .= $string . "\n";
802
+        $this->debug_info .= $string."\n";
803 803
     }
804 804
 
805 805
     /**
@@ -809,9 +809,9 @@  discard block
 block discarded – undo
809 809
     protected function xml_header($charsetEncoding = '')
810 810
     {
811 811
         if ($charsetEncoding != '') {
812
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
812
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
813 813
         } else {
814
-            return "<?xml version=\"1.0\"?" . ">\n";
814
+            return "<?xml version=\"1.0\"?".">\n";
815 815
         }
816 816
     }
817 817
 
@@ -1063,12 +1063,12 @@  discard block
 block discarded – undo
1063 1063
         }
1064 1064
 
1065 1065
         $req = new Request($methName->scalarval());
1066
-        foreach($params as $i => $param) {
1066
+        foreach ($params as $i => $param) {
1067 1067
             if (!$req->addParam($param)) {
1068 1068
                 $i++; // for error message, we count params from 1
1069 1069
                 return static::_xmlrpcs_multicall_error(new Response(0,
1070 1070
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1071
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1071
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1072 1072
             }
1073 1073
         }
1074 1074
 
@@ -1140,12 +1140,12 @@  discard block
 block discarded – undo
1140 1140
         // let accept a plain list of php parameters, beside a single xmlrpc msg object
1141 1141
         if (is_object($req)) {
1142 1142
             $calls = $req->getParam(0);
1143
-            foreach($calls as $call) {
1143
+            foreach ($calls as $call) {
1144 1144
                 $result[] = static::_xmlrpcs_multicall_do_call($server, $call);
1145 1145
             }
1146 1146
         } else {
1147 1147
             $numCalls = count($req);
1148
-            for ($i = 0; $i < $numCalls; $i++) {
1148
+            for ($i = 0; $i<$numCalls; $i++) {
1149 1149
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1150 1150
             }
1151 1151
         }
Please login to merge, or discard this patch.
src/Wrapper.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
             $callable = explode('::', $callable);
183 183
         }
184 184
         if (is_array($callable)) {
185
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
186
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
185
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
186
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
187 187
                 return false;
188 188
             }
189 189
             if (is_string($callable[0])) {
190 190
                 $plainFuncName = implode('::', $callable);
191 191
             } elseif (is_object($callable[0])) {
192
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
192
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
193 193
             }
194 194
             $exists = method_exists($callable[0], $callable[1]);
195 195
         } else if ($callable instanceof \Closure) {
196 196
             // we do not support creating code which wraps closures, as php does not allow to serialize them
197 197
             if (!$buildIt) {
198
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
198
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
199 199
                 return false;
200 200
             }
201 201
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         }
208 208
 
209 209
         if (!$exists) {
210
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
210
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
211 211
             return false;
212 212
         }
213 213
 
@@ -251,23 +251,23 @@  discard block
 block discarded – undo
251 251
         if (is_array($callable)) {
252 252
             $func = new \ReflectionMethod($callable[0], $callable[1]);
253 253
             if ($func->isPrivate()) {
254
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
254
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
255 255
                 return false;
256 256
             }
257 257
             if ($func->isProtected()) {
258
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
258
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
259 259
                 return false;
260 260
             }
261 261
             if ($func->isConstructor()) {
262
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
262
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
263 263
                 return false;
264 264
             }
265 265
             if ($func->isDestructor()) {
266
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
266
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
267 267
                 return false;
268 268
             }
269 269
             if ($func->isAbstract()) {
270
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
270
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
271 271
                 return false;
272 272
             }
273 273
             /// @todo add more checks for static vs. nonstatic?
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         if ($func->isInternal()) {
278 278
             // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
279 279
             // instead of getparameters to fully reflect internal php functions ?
280
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
280
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
281 281
             return false;
282 282
         }
283 283
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         $i = 0;
330 330
         foreach ($func->getParameters() as $paramObj) {
331 331
             $params[$i] = array();
332
-            $params[$i]['name'] = '$' . $paramObj->getName();
332
+            $params[$i]['name'] = '$'.$paramObj->getName();
333 333
             $params[$i]['isoptional'] = $paramObj->isOptional();
334 334
             $i++;
335 335
         }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             // build a signature
395 395
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
396 396
             $pSig = array($funcDesc['returnsDocs']);
397
-            for ($i = 0; $i < count($pars); $i++) {
397
+            for ($i = 0; $i<count($pars); $i++) {
398 398
                 $name = strtolower($funcDesc['params'][$i]['name']);
399 399
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
400 400
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
                 }
450 450
             }
451 451
             $numPars = $req->getNumParams();
452
-            if ($numPars < $minPars || $numPars > $maxPars) {
452
+            if ($numPars<$minPars || $numPars>$maxPars) {
453 453
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
454 454
             }
455 455
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 
463 463
             $result = call_user_func_array($callable, $params);
464 464
 
465
-            if (! is_a($result, $responseClass)) {
465
+            if (!is_a($result, $responseClass)) {
466 466
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
467 467
                     $result = new $valueClass($result, $funcDesc['returns']);
468 468
                 } else {
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
         if ($newFuncName == '') {
498 498
             if (is_array($callable)) {
499 499
                 if (is_string($callable[0])) {
500
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
500
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
501 501
                 } else {
502
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
502
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
503 503
                 }
504 504
             } else {
505 505
                 if ($callable instanceof \Closure) {
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
     {
536 536
         $namespace = '\\PhpXmlRpc\\';
537 537
 
538
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
539
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
538
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
539
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
540 540
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
541 541
 
542 542
         $i = 0;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         // build body of new function
572 572
 
573 573
         $innerCode = "\$paramCount = \$req->getNumParams();\n";
574
-        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
574
+        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
575 575
 
576 576
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
577 577
         if ($decodePhpObjects) {
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
         if (is_array($callable) && is_object($callable[0])) {
586 586
             self::$objHolder[$newFuncName] = $callable[0];
587 587
             $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n";
588
-            $realFuncName = '$obj->' . $callable[1];
588
+            $realFuncName = '$obj->'.$callable[1];
589 589
         } else {
590 590
             $realFuncName = $plainFuncName;
591 591
         }
592 592
         foreach ($parsVariations as $i => $pars) {
593
-            $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
594
-            if ($i < (count($parsVariations) - 1))
593
+            $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
594
+            if ($i<(count($parsVariations)-1))
595 595
                 $innerCode .= "else\n";
596 596
         }
597 597
         $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n";
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
         // if($func->returnsReference())
609 609
         //     return false;
610 610
 
611
-        $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}";
611
+        $code = "function $newFuncName(\$req) {\n".$innerCode."\n}";
612 612
 
613 613
         return $code;
614 614
     }
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array())
663 663
     {
664 664
         if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) {
665
-            return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . $classMethod;
665
+            return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod;
666 666
         }
667 667
 
668 668
         if (is_object($className)) {
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         } else {
671 671
             $realClassName = $className;
672 672
         }
673
-        return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . "$realClassName.$classMethod";
673
+        return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod";
674 674
     }
675 675
 
676 676
     /**
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
761 761
     {
762 762
         $namespace = '\\PhpXmlRpc\\';
763
-        $reqClass = $namespace . 'Request';
764
-        $valClass = $namespace . 'Value';
765
-        $decoderClass = $namespace . 'Encoder';
763
+        $reqClass = $namespace.'Request';
764
+        $valClass = $namespace.'Value';
765
+        $decoderClass = $namespace.'Encoder';
766 766
 
767 767
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
768
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
768
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
769 769
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
770
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
770
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
771 771
 
772 772
         $req = new $reqClass('system.methodSignature');
773 773
         $req->addparam(new $valClass($methodName));
774 774
         $client->setDebug($debug);
775 775
         $response = $client->send($req, $timeout, $protocol);
776 776
         if ($response->faultCode()) {
777
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
777
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
778 778
             return false;
779 779
         }
780 780
 
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
             $mSig = $decoder->decode($mSig);
785 785
         }
786 786
 
787
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
788
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
787
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
788
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
789 789
             return false;
790 790
         }
791 791
 
@@ -801,11 +801,11 @@  discard block
 block discarded – undo
801 801
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
802 802
     {
803 803
         $namespace = '\\PhpXmlRpc\\';
804
-        $reqClass = $namespace . 'Request';
805
-        $valClass = $namespace . 'Value';
804
+        $reqClass = $namespace.'Request';
805
+        $valClass = $namespace.'Value';
806 806
 
807 807
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
808
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
808
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
809 809
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
810 810
 
811 811
         $mDesc = '';
@@ -839,10 +839,10 @@  discard block
 block discarded – undo
839 839
         $clientClone = clone $client;
840 840
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
841 841
         {
842
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
842
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
843 843
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
844
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
845
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
844
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
845
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
846 846
             if (isset($extraOptions['return_on_fault'])) {
847 847
                 $decodeFault = true;
848 848
                 $faultResponse = $extraOptions['return_on_fault'];
@@ -851,9 +851,9 @@  discard block
 block discarded – undo
851 851
             }
852 852
 
853 853
             $namespace = '\\PhpXmlRpc\\';
854
-            $reqClass = $namespace . 'Request';
855
-            $encoderClass = $namespace . 'Encoder';
856
-            $valueClass = $namespace . 'Value';
854
+            $reqClass = $namespace.'Request';
855
+            $encoderClass = $namespace.'Encoder';
856
+            $valueClass = $namespace.'Value';
857 857
 
858 858
             $encoder = new $encoderClass();
859 859
             $encodeOptions = array();
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
             }
877 877
 
878 878
             $xmlrpcArgs = array();
879
-            foreach($currentArgs as $i => $arg) {
879
+            foreach ($currentArgs as $i => $arg) {
880 880
                 if ($i == $maxArgs) {
881 881
                     break;
882 882
                 }
@@ -924,13 +924,13 @@  discard block
 block discarded – undo
924 924
      * @param string $mDesc
925 925
      * @return string[] keys: source, docstring
926 926
      */
927
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
927
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
928 928
     {
929
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
929
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
930 930
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
931
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
932
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
933
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
931
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
932
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
933
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
934 934
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
935 935
         if (isset($extraOptions['return_on_fault'])) {
936 936
             $decodeFault = true;
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
         $namespace = '\\PhpXmlRpc\\';
944 944
 
945 945
         $code = "function $newFuncName (";
946
-        if ($clientCopyMode < 2) {
946
+        if ($clientCopyMode<2) {
947 947
             // client copy mode 0 or 1 == full / partial client copy in emitted code
948 948
             $verbatimClientCopy = !$clientCopyMode;
949 949
             $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace);
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 
959 959
         if ($mDesc != '') {
960 960
             // take care that PHP comment is not terminated unwillingly by method description
961
-            $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n";
961
+            $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n";
962 962
         } else {
963 963
             $mDesc = "/**\nFunction $newFuncName\n";
964 964
         }
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
968 968
         $plist = array();
969 969
         $pCount = count($mSig);
970
-        for ($i = 1; $i < $pCount; $i++) {
970
+        for ($i = 1; $i<$pCount; $i++) {
971 971
             $plist[] = "\$p$i";
972 972
             $pType = $mSig[$i];
973 973
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
@@ -983,19 +983,19 @@  discard block
 block discarded – undo
983 983
                 }
984 984
             }
985 985
             $innerCode .= "\$req->addparam(\$p$i);\n";
986
-            $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
986
+            $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n";
987 987
         }
988
-        if ($clientCopyMode < 2) {
988
+        if ($clientCopyMode<2) {
989 989
             $plist[] = '$debug=0';
990 990
             $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
991 991
         }
992 992
         $plist = implode(', ', $plist);
993
-        $mDesc .= '* @return {$namespace}Response|' . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n";
993
+        $mDesc .= '* @return {$namespace}Response|'.$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n";
994 994
 
995 995
         $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n";
996 996
         if ($decodeFault) {
997 997
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
998
-                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
998
+                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
999 999
             } else {
1000 1000
                 $respCode = var_export($faultResponse, true);
1001 1001
             }
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
             $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());";
1009 1009
         }
1010 1010
 
1011
-        $code = $code . $plist . ") {\n" . $innerCode . "\n}\n";
1011
+        $code = $code.$plist.") {\n".$innerCode."\n}\n";
1012 1012
 
1013 1013
         return array('source' => $code, 'docstring' => $mDesc);
1014 1014
     }
@@ -1034,23 +1034,23 @@  discard block
 block discarded – undo
1034 1034
     public function wrapXmlrpcServer($client, $extraOptions = array())
1035 1035
     {
1036 1036
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1037
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1037
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1038 1038
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1039 1039
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1040
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1041
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1040
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1041
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1042 1042
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1043 1043
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1044 1044
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1045 1045
         $namespace = '\\PhpXmlRpc\\';
1046 1046
 
1047
-        $reqClass = $namespace . 'Request';
1048
-        $decoderClass = $namespace . 'Encoder';
1047
+        $reqClass = $namespace.'Request';
1048
+        $decoderClass = $namespace.'Encoder';
1049 1049
 
1050 1050
         $req = new $reqClass('system.listMethods');
1051 1051
         $response = $client->send($req, $timeout, $protocol);
1052 1052
         if ($response->faultCode()) {
1053
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1053
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1054 1054
 
1055 1055
             return false;
1056 1056
         } else {
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
                 $mList = $decoder->decode($mList);
1061 1061
             }
1062 1062
             if (!is_array($mList) || !count($mList)) {
1063
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1063
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1064 1064
 
1065 1065
                 return false;
1066 1066
             } else {
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
                 if ($newClassName != '') {
1069 1069
                     $xmlrpcClassName = $newClassName;
1070 1070
                 } else {
1071
-                    $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1072
-                            array('_', ''), $client->server) . '_client';
1071
+                    $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1072
+                            array('_', ''), $client->server).'_client';
1073 1073
                 }
1074 1074
                 while ($buildIt && class_exists($xmlrpcClassName)) {
1075 1075
                     $xmlrpcClassName .= 'x';
@@ -1100,20 +1100,20 @@  discard block
 block discarded – undo
1100 1100
                             if (!$buildIt) {
1101 1101
                                 $source .= $methodWrap['docstring'];
1102 1102
                             }
1103
-                            $source .= $methodWrap['source'] . "\n";
1103
+                            $source .= $methodWrap['source']."\n";
1104 1104
                         } else {
1105
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1105
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1106 1106
                         }
1107 1107
                     }
1108 1108
                 }
1109 1109
                 $source .= "}\n";
1110 1110
                 if ($buildIt) {
1111 1111
                     $allOK = 0;
1112
-                    eval($source . '$allOK=1;');
1112
+                    eval($source.'$allOK=1;');
1113 1113
                     if ($allOK) {
1114 1114
                         return $xmlrpcClassName;
1115 1115
                     } else {
1116
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1116
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1117 1117
                         return false;
1118 1118
                     }
1119 1119
                 } else {
@@ -1134,10 +1134,10 @@  discard block
 block discarded – undo
1134 1134
      *
1135 1135
      * @return string
1136 1136
      */
1137
-    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' )
1137
+    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1138 1138
     {
1139
-        $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) .
1140
-            "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
1139
+        $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path).
1140
+            "', '".str_replace("'", "\'", $client->server)."', $client->port);\n";
1141 1141
 
1142 1142
         // copy all client fields to the client that will be generated runtime
1143 1143
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.
pakefile.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
         );
63 63
     }
64 64
 
65
-    public static function getOpts($args=array(), $cliOpts=array())
65
+    public static function getOpts($args = array(), $cliOpts = array())
66 66
     {
67
-        if (count($args) > 0)
67
+        if (count($args)>0)
68 68
         //    throw new \Exception('Missing library version argument');
69 69
             self::$libVersion = $args[0];
70 70
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
         $out = '';
162 162
         while (($start = strpos($content, $startTag, $last)) !== false) {
163 163
             $end = strpos($content, $endTag, $start);
164
-            $code = substr($content, $start + strlen($startTag), $end - $start - strlen($startTag));
165
-            if ($code[strlen($code) - 1] == "\n") {
164
+            $code = substr($content, $start+strlen($startTag), $end-$start-strlen($startTag));
165
+            if ($code[strlen($code)-1] == "\n") {
166 166
                 $code = substr($code, 0, -1);
167 167
             }
168 168
 
169 169
             $code = str_replace(array('&gt;', '&lt;'), array('>', '<'), $code);
170
-            $code = highlight_string('<?php ' . $code, true);
170
+            $code = highlight_string('<?php '.$code, true);
171 171
             $code = str_replace('<span style="color: #0000BB">&lt;?php&nbsp;<br />', '<span style="color: #0000BB">', $code);
172 172
 
173
-            $out = $out . substr($content, $last, $start + strlen($startTag) - $last) . $code . $endTag;
174
-            $last = $end + strlen($endTag);
173
+            $out = $out.substr($content, $last, $start+strlen($startTag)-$last).$code.$endTag;
174
+            $last = $end+strlen($endTag);
175 175
         }
176 176
         $out .= substr($content, $last, strlen($content));
177 177
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
 use PhpXmlRpc\Builder;
187 187
 
188
-function run_default($task=null, $args=array(), $cliOpts=array())
188
+function run_default($task = null, $args = array(), $cliOpts = array())
189 189
 {
190 190
     echo "Syntax: pake {\$pake-options} \$task \$lib-version [\$git-tag] {\$task-options}\n";
191 191
     echo "\n";
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     echo "      --zip=ZIP        Location of the zip tool\n";
203 203
 }
204 204
 
205
-function run_getopts($task=null, $args=array(), $cliOpts=array())
205
+function run_getopts($task = null, $args = array(), $cliOpts = array())
206 206
 {
207 207
     Builder::getOpts($args, $cliOpts);
208 208
 }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
  * Downloads source code in the build workspace directory, optionally checking out the given branch/tag
212 212
  * @todo allow using current installation as source, bypassing git clone in workspace - at least for doc generation
213 213
  */
214
-function run_init($task=null, $args=array(), $cliOpts=array())
214
+function run_init($task = null, $args = array(), $cliOpts = array())
215 215
 {
216 216
     // download the current version into the workspace
217 217
     $targetDir = Builder::workspaceDir();
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
  *
240 240
  * (does nothing by itself, as all the steps are managed via task dependencies)
241 241
  */
242
-function run_build($task=null, $args=array(), $cliOpts=array())
242
+function run_build($task = null, $args = array(), $cliOpts = array())
243 243
 {
244 244
 }
245 245
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 /**
256 256
  * Generates documentation in all formats
257 257
  */
258
-function run_doc($task=null, $args=array(), $cliOpts=array())
258
+function run_doc($task = null, $args = array(), $cliOpts = array())
259 259
 {
260 260
     // in
261 261
     $srcDir = Builder::workspaceDir();
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
     // from phpdoc comments using phpdocumentor
268 268
     $cmd = Builder::tool('php');
269
-    pake_sh("$cmd " . Builder::toolsDir(). "/vendor/bin/phpdoc run --cache-folder ".Builder::buildDir()."/.phpdoc -d ".$srcDir.'/src'." -t ".$docDir.'/api --title PHP-XMLRPC');
269
+    pake_sh("$cmd ".Builder::toolsDir()."/vendor/bin/phpdoc run --cache-folder ".Builder::buildDir()."/.phpdoc -d ".$srcDir.'/src'." -t ".$docDir.'/api --title PHP-XMLRPC');
270 270
 
271 271
     // from phpdoc comments using Sami
272 272
     // deprecated on 2021/12, as Sami is abandonware
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 /**
348 348
  * Creates the tarballs for a release
349 349
  */
350
-function run_dist($task=null, $args=array(), $cliOpts=array())
350
+function run_dist($task = null, $args = array(), $cliOpts = array())
351 351
 {
352 352
     // copy workspace dir into dist dir, without git
353 353
     pake_mkdirs(Builder::distDir());
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     // create tarballs
362 362
     $cwd = getcwd();
363 363
     chdir(dirname(Builder::distDir()));
364
-    foreach(Builder::distFiles() as $distFile) {
364
+    foreach (Builder::distFiles() as $distFile) {
365 365
         // php can not really create good zip files via phar: they are not compressed!
366 366
         if (substr($distFile, -4) == '.zip') {
367 367
             $cmd = Builder::tool('zip');
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     chdir($cwd);
380 380
 }
381 381
 
382
-function run_clean_workspace($task=null, $args=array(), $cliOpts=array())
382
+function run_clean_workspace($task = null, $args = array(), $cliOpts = array())
383 383
 {
384 384
     pake_remove_dir(Builder::workspaceDir());
385 385
 }
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
  * Cleans up the whole build directory
389 389
  * @todo 'make clean' usually just removes the results of the build, distclean removes all but sources
390 390
  */
391
-function run_clean($task=null, $args=array(), $cliOpts=array())
391
+function run_clean($task = null, $args = array(), $cliOpts = array())
392 392
 {
393 393
     pake_remove_dir(Builder::buildDir());
394 394
 }
395 395
 
396 396
 // helper task: display help text
397
-pake_task( 'default' );
397
+pake_task('default');
398 398
 // internal task: parse cli options
399 399
 pake_task('getopts');
400 400
 pake_task('init', 'getopts');
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
             $server = $parts['host'];
158 158
             $path = isset($parts['path']) ? $parts['path'] : '';
159 159
             if (isset($parts['query'])) {
160
-                $path .= '?' . $parts['query'];
160
+                $path .= '?'.$parts['query'];
161 161
             }
162 162
             if (isset($parts['fragment'])) {
163
-                $path .= '#' . $parts['fragment'];
163
+                $path .= '#'.$parts['fragment'];
164 164
             }
165 165
             if (isset($parts['port'])) {
166 166
                 $port = $parts['port'];
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             }
177 177
         }
178 178
         if ($path == '' || $path[0] != '/') {
179
-            $this->path = '/' . $path;
179
+            $this->path = '/'.$path;
180 180
         } else {
181 181
             $this->path = $path;
182 182
         }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         }*/
215 215
 
216 216
         // initialize user_agent string
217
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
217
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
218 218
     }
219 219
 
220 220
     /**
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
      */
593 593
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
594 594
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
595
-        $method='http')
595
+        $method = 'http')
596 596
     {
597 597
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
598 598
 
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
      * @param int $sslVersion
625 625
      * @return Response
626 626
      */
627
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
627
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
628 628
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
629 629
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
630 630
         $sslVersion = 0)
@@ -663,13 +663,13 @@  discard block
 block discarded – undo
663 663
      */
664 664
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
665 665
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
666
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
666
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
667 667
         $sslVersion = 0)
668 668
     {
669 669
         /// @todo log a warning if passed an unsupported method
670 670
 
671 671
         if ($port == 0) {
672
-            $port = ( $method === 'https' ) ? 443 : 80;
672
+            $port = ($method === 'https') ? 443 : 80;
673 673
         }
674 674
 
675 675
         // Only create the payload if it was not created previously
@@ -699,15 +699,15 @@  discard block
 block discarded – undo
699 699
         // thanks to Grant Rauscher <[email protected]> for this
700 700
         $credentials = '';
701 701
         if ($username != '') {
702
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
702
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
703 703
             if ($authType != 1) {
704
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
704
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
705 705
             }
706 706
         }
707 707
 
708 708
         $acceptedEncoding = '';
709 709
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
710
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
710
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
711 711
         }
712 712
 
713 713
         $proxyCredentials = '';
@@ -718,17 +718,17 @@  discard block
 block discarded – undo
718 718
             $connectServer = $proxyHost;
719 719
             $connectPort = $proxyPort;
720 720
             $transport = 'tcp';
721
-            $uri = 'http://' . $server . ':' . $port . $this->path;
721
+            $uri = 'http://'.$server.':'.$port.$this->path;
722 722
             if ($proxyUsername != '') {
723 723
                 if ($proxyAuthType != 1) {
724
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
724
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
725 725
                 }
726
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
726
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
727 727
             }
728 728
         } else {
729 729
             $connectServer = $server;
730 730
             $connectPort = $port;
731
-            $transport = ( $method === 'https' ) ? 'tls' : 'tcp';
731
+            $transport = ($method === 'https') ? 'tls' : 'tcp';
732 732
             $uri = $this->path;
733 733
         }
734 734
 
@@ -738,45 +738,45 @@  discard block
 block discarded – undo
738 738
             $version = '';
739 739
             foreach ($this->cookies as $name => $cookie) {
740 740
                 if ($cookie['version']) {
741
-                    $version = ' $Version="' . $cookie['version'] . '";';
742
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
741
+                    $version = ' $Version="'.$cookie['version'].'";';
742
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
743 743
                     if ($cookie['path']) {
744
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
744
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
745 745
                     }
746 746
                     if ($cookie['domain']) {
747
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
747
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
748 748
                     }
749 749
                     if ($cookie['port']) {
750
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
750
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
751 751
                     }
752 752
                 } else {
753
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
753
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
754 754
                 }
755 755
             }
756
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
756
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
757 757
         }
758 758
 
759 759
         // omit port if default
760 760
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
761
-            $port =  '';
761
+            $port = '';
762 762
         } else {
763
-            $port = ':' . $port;
763
+            $port = ':'.$port;
764 764
         }
765 765
 
766
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
767
-            'User-Agent: ' . $this->user_agent . "\r\n" .
768
-            'Host: ' . $server . $port . "\r\n" .
769
-            $credentials .
770
-            $proxyCredentials .
771
-            $acceptedEncoding .
772
-            $encodingHdr .
773
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
774
-            $cookieHeader .
775
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
776
-            strlen($payload) . "\r\n\r\n" .
766
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
767
+            'User-Agent: '.$this->user_agent."\r\n".
768
+            'Host: '.$server.$port."\r\n".
769
+            $credentials.
770
+            $proxyCredentials.
771
+            $acceptedEncoding.
772
+            $encodingHdr.
773
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
774
+            $cookieHeader.
775
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
776
+            strlen($payload)."\r\n\r\n".
777 777
             $payload;
778 778
 
779
-        if ($this->debug > 1) {
779
+        if ($this->debug>1) {
780 780
             $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---");
781 781
         }
782 782
 
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 
804 804
         $context = stream_context_create($contextOptions);
805 805
 
806
-        if ($timeout <= 0) {
806
+        if ($timeout<=0) {
807 807
             $connectTimeout = ini_get('default_socket_timeout');
808 808
         } else {
809 809
             $connectTimeout = $timeout;
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
816 816
             STREAM_CLIENT_CONNECT, $context);
817 817
         if ($fp) {
818
-            if ($timeout > 0) {
818
+            if ($timeout>0) {
819 819
                 stream_set_timeout($fp, $timeout);
820 820
             }
821 821
         } else {
@@ -824,8 +824,8 @@  discard block
 block discarded – undo
824 824
                 $this->errstr = $err['message'];
825 825
             }
826 826
 
827
-            $this->errstr = 'Connect error: ' . $this->errstr;
828
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
827
+            $this->errstr = 'Connect error: '.$this->errstr;
828
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
829 829
 
830 830
             return $r;
831 831
         }
@@ -914,13 +914,13 @@  discard block
 block discarded – undo
914 914
 
915 915
         $result = curl_exec($curl);
916 916
 
917
-        if ($this->debug > 1) {
917
+        if ($this->debug>1) {
918 918
             $message = "---CURL INFO---\n";
919 919
             foreach (curl_getinfo($curl) as $name => $val) {
920 920
                 if (is_array($val)) {
921 921
                     $val = implode("\n", $val);
922 922
                 }
923
-                $message .= $name . ': ' . $val . "\n";
923
+                $message .= $name.': '.$val."\n";
924 924
             }
925 925
             $message .= '---END---';
926 926
             $this->getLogger()->debugMessage($message);
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
             /// @todo we should use a better check here - what if we get back '' or '0'?
931 931
 
932 932
             $this->errstr = 'no response';
933
-            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
933
+            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
934 934
             curl_close($curl);
935 935
             if ($keepAlive) {
936 936
                 $this->xmlrpc_curl_handle = null;
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
                     $protocol = $method;
1000 1000
                 }
1001 1001
             }
1002
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
1002
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
1003 1003
             if ($keepAlive) {
1004 1004
                 $this->xmlrpc_curl_handle = $curl;
1005 1005
             }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
         // results into variable
1011 1011
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1012 1012
 
1013
-        if ($this->debug > 1) {
1013
+        if ($this->debug>1) {
1014 1014
             curl_setopt($curl, CURLOPT_VERBOSE, true);
1015 1015
             /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
1016 1016
         }
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
             }
1036 1036
         }
1037 1037
         // extra headers
1038
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
1038
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
1039 1039
         // if no keepalive is wanted, let the server know it in advance
1040 1040
         if (!$keepAlive) {
1041 1041
             $headers[] = 'Connection: close';
@@ -1052,10 +1052,10 @@  discard block
 block discarded – undo
1052 1052
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1053 1053
         // timeout is borked
1054 1054
         if ($timeout) {
1055
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
1055
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
1056 1056
         }
1057 1057
 
1058
-        switch($method) {
1058
+        switch ($method) {
1059 1059
             case 'http10':
1060 1060
                 curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
1061 1061
                 break;
@@ -1071,11 +1071,11 @@  discard block
 block discarded – undo
1071 1071
         }
1072 1072
 
1073 1073
         if ($username && $password) {
1074
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
1074
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
1075 1075
             if (defined('CURLOPT_HTTPAUTH')) {
1076 1076
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
1077 1077
             } elseif ($authType != 1) {
1078
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
1078
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
1079 1079
             }
1080 1080
         }
1081 1081
 
@@ -1117,13 +1117,13 @@  discard block
 block discarded – undo
1117 1117
             if ($proxyPort == 0) {
1118 1118
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1119 1119
             }
1120
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1120
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1121 1121
             if ($proxyUsername) {
1122
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1122
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1123 1123
                 if (defined('CURLOPT_PROXYAUTH')) {
1124 1124
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1125 1125
                 } elseif ($proxyAuthType != 1) {
1126
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1126
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1127 1127
                 }
1128 1128
             }
1129 1129
         }
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
         if (count($this->cookies)) {
1134 1134
             $cookieHeader = '';
1135 1135
             foreach ($this->cookies as $name => $cookie) {
1136
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1136
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1137 1137
             }
1138 1138
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1139 1139
         }
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
             curl_setopt($curl, $opt, $val);
1143 1143
         }
1144 1144
 
1145
-        if ($this->debug > 1) {
1145
+        if ($this->debug>1) {
1146 1146
             $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---");
1147 1147
         }
1148 1148
 
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
             $call['methodName'] = new Value($req->method(), 'string');
1241 1241
             $numParams = $req->getNumParams();
1242 1242
             $params = array();
1243
-            for ($i = 0; $i < $numParams; $i++) {
1243
+            for ($i = 0; $i<$numParams; $i++) {
1244 1244
                 $params[$i] = $req->getParam($i);
1245 1245
             }
1246 1246
             $call['params'] = new Value($params, 'array');
@@ -1266,15 +1266,15 @@  discard block
 block discarded – undo
1266 1266
             /// @todo test this code branch...
1267 1267
             $rets = $result->value();
1268 1268
             if (!is_array($rets)) {
1269
-                return false;       // bad return type from system.multicall
1269
+                return false; // bad return type from system.multicall
1270 1270
             }
1271 1271
             $numRets = count($rets);
1272 1272
             if ($numRets != count($reqs)) {
1273
-                return false;       // wrong number of return values.
1273
+                return false; // wrong number of return values.
1274 1274
             }
1275 1275
 
1276 1276
             $response = array();
1277
-            for ($i = 0; $i < $numRets; $i++) {
1277
+            for ($i = 0; $i<$numRets; $i++) {
1278 1278
                 $val = $rets[$i];
1279 1279
                 if (!is_array($val)) {
1280 1280
                     return false;
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
                 switch (count($val)) {
1283 1283
                     case 1:
1284 1284
                         if (!isset($val[0])) {
1285
-                            return false;       // Bad value
1285
+                            return false; // Bad value
1286 1286
                         }
1287 1287
                         // Normal return value
1288 1288
                         $response[$i] = new Response($val[0], 0, '', 'phpvals');
@@ -1310,19 +1310,19 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
             $rets = $result->value();
1312 1312
             if ($rets->kindOf() != 'array') {
1313
-                return false;       // bad return type from system.multicall
1313
+                return false; // bad return type from system.multicall
1314 1314
             }
1315 1315
             $numRets = $rets->count();
1316 1316
             if ($numRets != count($reqs)) {
1317
-                return false;       // wrong number of return values.
1317
+                return false; // wrong number of return values.
1318 1318
             }
1319 1319
 
1320 1320
             $response = array();
1321
-            foreach($rets as $val) {
1321
+            foreach ($rets as $val) {
1322 1322
                 switch ($val->kindOf()) {
1323 1323
                     case 'array':
1324 1324
                         if ($val->count() != 1) {
1325
-                            return false;       // Bad value
1325
+                            return false; // Bad value
1326 1326
                         }
1327 1327
                         // Normal return value
1328 1328
                         $response[] = new Response($val[0]);
Please login to merge, or discard this patch.
extras/benchmark.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 use PhpXmlRpc\Encoder;
20 20
 
21 21
 /// @todo allow autoloading when the library is installed as dependency
22
-include_once __DIR__ . '/../vendor/autoload.php';
22
+include_once __DIR__.'/../vendor/autoload.php';
23 23
 
24
-include __DIR__ . '/../tests/parse_args.php';
24
+include __DIR__.'/../tests/parse_args.php';
25 25
 $args = argParser::getArgs();
26 26
 
27 27
 function begin_test($test_name, $test_case)
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     if (!isset($test_results[$test_name][$test_case])) {
42 42
         trigger_error('ending test that was not started');
43 43
     }
44
-    $test_results[$test_name][$test_case]['time'] = $end - $test_results[$test_name][$test_case]['time'];
44
+    $test_results[$test_name][$test_case]['time'] = $end-$test_results[$test_name][$test_case]['time'];
45 45
     $test_results[$test_name][$test_case]['result'] = $test_result;
46 46
     echo '.';
47 47
     flush();
@@ -75,24 +75,24 @@  discard block
 block discarded – undo
75 75
 }
76 76
 
77 77
 if ($is_web) {
78
-    echo "<h3>Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "</h3>\n";
78
+    echo "<h3>Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."</h3>\n";
79 79
     if ($xd) {
80
-        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: " . htmlspecialchars(xdebug_get_profiler_filename()) . "</h4>\n";
80
+        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n";
81 81
     }
82 82
     flush();
83 83
     ob_flush();
84 84
 } else {
85
-    echo "Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "\n";
85
+    echo "Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."\n";
86 86
     if ($xd) {
87
-        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: " . xdebug_get_profiler_filename() . "\n";
87
+        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: ".xdebug_get_profiler_filename()."\n";
88 88
     }
89 89
 }
90 90
 
91 91
 // test 'manual style' data encoding vs. 'automatic style' encoding
92 92
 begin_test('Data encoding (large array)', 'manual encoding');
93
-for ($i = 0; $i < $num_tests; $i++) {
93
+for ($i = 0; $i<$num_tests; $i++) {
94 94
     $vals = array();
95
-    for ($j = 0; $j < 10; $j++) {
95
+    for ($j = 0; $j<10; $j++) {
96 96
         $valarray = array();
97 97
         foreach ($data[$j] as $key => $val) {
98 98
             $values = array();
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 begin_test('Data encoding (large array)', 'automatic encoding');
119 119
 $encoder = new Encoder();
120
-for ($i = 0; $i < $num_tests; $i++) {
120
+for ($i = 0; $i<$num_tests; $i++) {
121 121
     $value = $encoder->encode($data, array('auto_dates'));
122 122
     $out = $value->serialize();
123 123
 }
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 if (function_exists('xmlrpc_set_type')) {
127 127
     begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
128
-    for ($i = 0; $i < $num_tests; $i++) {
129
-        for ($j = 0; $j < 10; $j++) {
128
+    for ($i = 0; $i<$num_tests; $i++) {
129
+        for ($j = 0; $j<10; $j++) {
130 130
             foreach ($keys as $k) {
131 131
                 xmlrpc_set_type($data[$j][$k][4], 'datetime');
132 132
                 xmlrpc_set_type($data[$j][$k][8], 'datetime');
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 // test 'old style' data decoding vs. 'automatic style' decoding
141 141
 $dummy = new Request('');
142 142
 $out = new Response($value);
143
-$in = '<?xml version="1.0" ?>' . "\n" . $out->serialize();
143
+$in = '<?xml version="1.0" ?>'."\n".$out->serialize();
144 144
 
145 145
 begin_test('Data decoding (large array)', 'manual decoding');
146
-for ($i = 0; $i < $num_tests; $i++) {
146
+for ($i = 0; $i<$num_tests; $i++) {
147 147
     $response = $dummy->ParseResponse($in, true);
148 148
     $value = $response->value();
149 149
     $result = array();
150
-    foreach($value as $val1) {
150
+    foreach ($value as $val1) {
151 151
         $out = array();
152
-        foreach($val1 as $name => $val) {
152
+        foreach ($val1 as $name => $val) {
153 153
             $out[$name] = array();
154
-            foreach($val as $data) {
154
+            foreach ($val as $data) {
155 155
                 $out[$name][] = $data->scalarval();
156 156
             }
157 157
         }
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
 end_test('Data decoding (large array)', 'manual decoding', $result);
162 162
 
163 163
 begin_test('Data decoding (large array)', 'manual decoding deprecated');
164
-for ($i = 0; $i < $num_tests; $i++) {
164
+for ($i = 0; $i<$num_tests; $i++) {
165 165
     $response = $dummy->ParseResponse($in, true);
166 166
     $value = $response->value();
167 167
     $result = array();
168 168
     $l = $value->arraysize();
169
-    for ($k = 0; $k < $l; $k++) {
169
+    for ($k = 0; $k<$l; $k++) {
170 170
         $val1 = $value->arraymem($k);
171 171
         $out = array();
172
-        foreach($val1 as $name => $val) {
172
+        foreach ($val1 as $name => $val) {
173 173
             $out[$name] = array();
174 174
             $m = $val->arraysize();
175
-            for ($j = 0; $j < $m; $j++) {
175
+            for ($j = 0; $j<$m; $j++) {
176 176
                 $data = $val->arraymem($j);
177 177
                 $out[$name][] = $data->scalarval();
178 178
             }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 end_test('Data decoding (large array)', 'manual decoding deprecated', $result);
184 184
 
185 185
 begin_test('Data decoding (large array)', 'automatic decoding');
186
-for ($i = 0; $i < $num_tests; $i++) {
186
+for ($i = 0; $i<$num_tests; $i++) {
187 187
     $response = $dummy->ParseResponse($in, true, 'phpvals');
188 188
     $value = $response->value();
189 189
 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 if (function_exists('xmlrpc_decode')) {
193 193
     begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
194
-    for ($i = 0; $i < $num_tests; $i++) {
194
+    for ($i = 0; $i<$num_tests; $i++) {
195 195
         $response = $dummy->ParseResponse($in, true, 'xml');
196 196
         $value = xmlrpc_decode($response->value());
197 197
     }
@@ -208,16 +208,16 @@  discard block
 block discarded – undo
208 208
     $value = $encoder->encode($data1, array('auto_dates'));
209 209
     $req = new Request('interopEchoTests.echoValue', array($value));
210 210
     $reqs = array();
211
-    for ($i = 0; $i < $num_tests; $i++) {
211
+    for ($i = 0; $i<$num_tests; $i++) {
212 212
         $reqs[] = $req;
213 213
     }
214 214
 
215 215
     $server = explode(':', $args['HTTPSERVER']);
216
-    if (count($server) > 1) {
217
-        $srv = 'http://' . $server[0] . '://' . $server[1] . $args['HTTPURI'];
216
+    if (count($server)>1) {
217
+        $srv = 'http://'.$server[0].'://'.$server[1].$args['HTTPURI'];
218 218
         $c = new Client($args['HTTPURI'], $server[0], $server[1]);
219 219
     } else {
220
-        $srv = 'http://' . $args['HTTPSERVER'] . $args['HTTPURI'];
220
+        $srv = 'http://'.$args['HTTPSERVER'].$args['HTTPURI'];
221 221
         $c = new Client($args['HTTPURI'], $args['HTTPSERVER']);
222 222
     }
223 223
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
     begin_test($testName, 'http 10');
231 231
     $response = array();
232
-    for ($i = 0; $i < $num_tests; $i++) {
232
+    for ($i = 0; $i<$num_tests; $i++) {
233 233
         $resp = $c->send($req);
234 234
         $response[] = $resp->value();
235 235
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $c->keepalive = false;
240 240
         begin_test($testName, 'http 11 no keepalive');
241 241
         $response = array();
242
-        for ($i = 0; $i < $num_tests; $i++) {
242
+        for ($i = 0; $i<$num_tests; $i++) {
243 243
             $resp = $c->send($req, 10, 'http11');
244 244
             $response[] = $resp->value();
245 245
         }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
         begin_test($testName, 'http 11 w. keep-alive');
249 249
         $response = array();
250
-        for ($i = 0; $i < $num_tests; $i++) {
250
+        for ($i = 0; $i<$num_tests; $i++) {
251 251
             $resp = $c->send($req, 10, 'http11');
252 252
             $response[] = $resp->value();
253 253
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         begin_test($testName, 'http 10 w. compression');
271 271
         $response = array();
272
-        for ($i = 0; $i < $num_tests; $i++) {
272
+        for ($i = 0; $i<$num_tests; $i++) {
273 273
             $resp = $c->send($req);
274 274
             $response[] = $resp->value();
275 275
         }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             $c->keepalive = false;
280 280
             begin_test($testName, 'http 11 w. compression and no keepalive');
281 281
             $response = array();
282
-            for ($i = 0; $i < $num_tests; $i++) {
282
+            for ($i = 0; $i<$num_tests; $i++) {
283 283
                 $resp = $c->send($req, 10, 'http11');
284 284
                 $response[] = $resp->value();
285 285
             }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
             $c->keepalive = true;
289 289
             begin_test($testName, 'http 11 w. keep-alive and compression');
290 290
             $response = array();
291
-            for ($i = 0; $i < $num_tests; $i++) {
291
+            for ($i = 0; $i<$num_tests; $i++) {
292 292
                 $resp = $c->send($req, 10, 'http11');
293 293
                 $response[] = $resp->value();
294 294
             }
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
         /// test multicall vs. many calls vs. keep-alives - HTTPS
310 310
 
311 311
         $server = explode(':', $args['HTTPSSERVER']);
312
-        if (count($server) > 1) {
313
-            $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI'];
312
+        if (count($server)>1) {
313
+            $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI'];
314 314
             $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https');
315 315
         } else {
316
-            $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI'];
316
+            $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI'];
317 317
             $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'https');
318 318
         }
319 319
         $c->setSSLVerifyPeer(!$args['HTTPSIGNOREPEER']);
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         begin_test($testName, 'https no keep-alive');
328 328
         $c->keepalive = false;
329 329
         $response = array();
330
-        for ($i = 0; $i < $num_tests; $i++) {
330
+        for ($i = 0; $i<$num_tests; $i++) {
331 331
             $resp = $c->send($req);
332 332
             $response[] = $resp->value();
333 333
         }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         begin_test($testName, 'https w. keep-alive');
337 337
         $c->keepalive = true;
338 338
         $response = array();
339
-        for ($i = 0; $i < $num_tests; $i++) {
339
+        for ($i = 0; $i<$num_tests; $i++) {
340 340
             $resp = $c->send($req, 10);
341 341
             $response[] = $resp->value();
342 342
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             $c->keepalive = false;
358 358
             begin_test($testName, 'https w. compression and no keepalive');
359 359
             $response = array();
360
-            for ($i = 0; $i < $num_tests; $i++) {
360
+            for ($i = 0; $i<$num_tests; $i++) {
361 361
                 $resp = $c->send($req);
362 362
                 $response[] = $resp->value();
363 363
             }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $c->keepalive = true;
367 367
             begin_test($testName, 'https w. keep-alive and compression');
368 368
             $response = array();
369
-            for ($i = 0; $i < $num_tests; $i++) {
369
+            for ($i = 0; $i<$num_tests; $i++) {
370 370
                 $resp = $c->send($req, 10);
371 371
                 $response[] = $resp->value();
372 372
             }
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
         /// test multicall vs. many calls vs. keep-alives - HTTP/2
388 388
 
389 389
         $server = explode(':', $args['HTTPSSERVER']);
390
-        if (count($server) > 1) {
391
-            $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI'];
390
+        if (count($server)>1) {
391
+            $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI'];
392 392
             $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https');
393 393
         } else {
394
-            $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI'];
394
+            $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI'];
395 395
             $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'h2');
396 396
         }
397 397
         $c->setSSLVerifyPeer(!$args['HTTPSIGNOREPEER']);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         begin_test($testName, 'http2 no keep-alive');
406 406
         $c->keepalive = false;
407 407
         $response = array();
408
-        for ($i = 0; $i < $num_tests; $i++) {
408
+        for ($i = 0; $i<$num_tests; $i++) {
409 409
             $resp = $c->send($req);
410 410
             $response[] = $resp->value();
411 411
         }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         begin_test($testName, 'http2 w. keep-alive');
415 415
         $c->keepalive = true;
416 416
         $response = array();
417
-        for ($i = 0; $i < $num_tests; $i++) {
417
+        for ($i = 0; $i<$num_tests; $i++) {
418 418
             $resp = $c->send($req, 10);
419 419
             $response[] = $resp->value();
420 420
         }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             $c->keepalive = false;
436 436
             begin_test($testName, 'http2 w. compression and no keepalive');
437 437
             $response = array();
438
-            for ($i = 0; $i < $num_tests; $i++) {
438
+            for ($i = 0; $i<$num_tests; $i++) {
439 439
                 $resp = $c->send($req);
440 440
                 $response[] = $resp->value();
441 441
             }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             $c->keepalive = true;
445 445
             begin_test($testName, 'http2 w. keep-alive and compression');
446 446
             $response = array();
447
-            for ($i = 0; $i < $num_tests; $i++) {
447
+            for ($i = 0; $i<$num_tests; $i++) {
448 448
                 $resp = $c->send($req, 10);
449 449
                 $response[] = $resp->value();
450 450
             }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 foreach ($test_results as $test => $results) {
467 467
     echo "\nTEST: $test\n";
468 468
     foreach ($results as $case => $data) {
469
-        echo "  $case: {$data['time']} secs - Output data CRC: " . crc32(serialize($data['result'])) . "\n";
469
+        echo "  $case: {$data['time']} secs - Output data CRC: ".crc32(serialize($data['result']))."\n";
470 470
     }
471 471
 }
472 472
 
Please login to merge, or discard this patch.
debugger/action.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 <body>
93 93
 <?php
94 94
 
95
-include __DIR__ . '/common.php';
95
+include __DIR__.'/common.php';
96 96
 
97 97
 if ($action) {
98 98
 
99 99
     // make sure the script waits long enough for the call to complete...
100 100
     if ($timeout) {
101
-        set_time_limit($timeout + 10);
101
+        set_time_limit($timeout+10);
102 102
     }
103 103
 
104 104
     if ($wstype == 1) {
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
         $server = "$host$path";
124 124
     }
125 125
     if ($protocol == 2) {
126
-        $server = 'https://' . $server;
126
+        $server = 'https://'.$server;
127 127
     } else {
128
-        $server = 'http://' . $server;
128
+        $server = 'http://'.$server;
129 129
     }
130 130
     if ($proxy != '') {
131 131
         $pproxy = explode(':', $proxy);
132
-        if (count($pproxy) > 1) {
132
+        if (count($pproxy)>1) {
133 133
             $pport = $pproxy[1];
134 134
         } else {
135 135
             $pport = 8080;
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
         case 'wrap':
199 199
             $msg[0] = new $requestClass('system.methodHelp', array(), $id);
200 200
             $msg[0]->addparam(new PhpXmlRpc\Value($method));
201
-            $msg[1] = new $requestClass('system.methodSignature', array(), (int)$id + 1);
201
+            $msg[1] = new $requestClass('system.methodSignature', array(), (int) $id+1);
202 202
             $msg[1]->addparam(new PhpXmlRpc\Value($method));
203
-            $actionname = 'Description of method "' . $method . '"';
203
+            $actionname = 'Description of method "'.$method.'"';
204 204
             break;
205 205
         case 'list':
206 206
             $msg[0] = new $requestClass('system.listMethods', array(), $id);
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
             $msg[0] = new $requestClass($method, array(), $id);
214 214
             // hack! build xml payload by hand
215 215
             if ($wstype == 1) {
216
-                $msg[0]->payload = "{\n" .
217
-                    '"method": "' . $method . "\",\n\"params\": [" .
218
-                    $payload .
216
+                $msg[0]->payload = "{\n".
217
+                    '"method": "'.$method."\",\n\"params\": [".
218
+                    $payload.
219 219
                     "\n],\n\"id\": ";
220 220
                 // fix: if user gave an empty string, use NULL, or we'll break json syntax
221 221
                 if ($id == "") {
@@ -228,20 +228,20 @@  discard block
 block discarded – undo
228 228
                     }
229 229
                 }
230 230
             } else {
231
-                $msg[0]->payload = $msg[0]->xml_header($inputcharset) .
232
-                    '<methodName>' . $method . "</methodName>\n<params>" .
233
-                    $payload .
234
-                    "</params>\n" . $msg[0]->xml_footer();
231
+                $msg[0]->payload = $msg[0]->xml_header($inputcharset).
232
+                    '<methodName>'.$method."</methodName>\n<params>".
233
+                    $payload.
234
+                    "</params>\n".$msg[0]->xml_footer();
235 235
             }
236
-            $actionname = 'Execution of method ' . $method;
236
+            $actionname = 'Execution of method '.$method;
237 237
             break;
238 238
         default: // give a warning
239
-            $actionname = '[ERROR: unknown action] "' . $action . '"';
239
+            $actionname = '[ERROR: unknown action] "'.$action.'"';
240 240
     }
241 241
 
242 242
     // Before calling execute, echo out brief description of action taken + date and time ???
243 243
     // this gives good user feedback for long-running methods...
244
-    echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...</h2>\n";
244
+    echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset)." ...</h2>\n";
245 245
     flush();
246 246
 
247 247
     $response = null;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             break;
260 260
         }
261 261
     }
262
-    $time = microtime(true) - $time;
262
+    $time = microtime(true)-$time;
263 263
     if ($debug) {
264 264
         echo "</div>\n";
265 265
     }
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
             // call failed! echo out error msg!
270 270
             //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>';
271 271
             echo "<h3>$protoName call FAILED!</h3>\n";
272
-            echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
273
-                "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n";
272
+            echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding).
273
+                "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."'</p>\n";
274 274
             echo(date("d/M/Y:H:i:s\n"));
275 275
         } else {
276 276
             // call succeeded: parse results
@@ -286,36 +286,36 @@  discard block
 block discarded – undo
286 286
                         $max = $v->count();
287 287
                         echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
288 288
                         echo "<thead>\n<tr><th>Method ($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n";
289
-                        foreach($v as $i => $rec) {
289
+                        foreach ($v as $i => $rec) {
290 290
                             if ($i % 2) {
291 291
                                 $class = ' class="oddrow"';
292 292
                             } else {
293 293
                                 $class = ' class="evenrow"';
294 294
                             }
295
-                            echo("<tr><td$class>" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" .
296
-                                "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" .
297
-                                "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" .
298
-                                "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" .
299
-                                "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" .
300
-                                "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" .
301
-                                "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" .
302
-                                "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" .
303
-                                "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" .
304
-                                "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" .
305
-                                "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" .
306
-                                "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" .
307
-                                "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" .
308
-                                "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" .
309
-                                "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" .
310
-                                "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" .
311
-                                "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" .
312
-                                "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" .
313
-                                "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" .
314
-                                "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" .
315
-                                "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" .
316
-                                "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" .
317
-                                "<input type=\"hidden\" name=\"action\" value=\"describe\" />" .
318
-                                "<input type=\"hidden\" name=\"run\" value=\"now\" />" .
295
+                            echo("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">".
296
+                                "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />".
297
+                                "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />".
298
+                                "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />".
299
+                                "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />".
300
+                                "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />".
301
+                                "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />".
302
+                                "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />".
303
+                                "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />".
304
+                                "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />".
305
+                                "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />".
306
+                                "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />".
307
+                                "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />".
308
+                                "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />".
309
+                                "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />".
310
+                                "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />".
311
+                                "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />".
312
+                                "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />".
313
+                                "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />".
314
+                                "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />".
315
+                                "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."\" />".
316
+                                "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />".
317
+                                "<input type=\"hidden\" name=\"action\" value=\"describe\" />".
318
+                                "<input type=\"hidden\" name=\"run\" value=\"now\" />".
319 319
                                 "<input type=\"submit\" value=\"Describe\" /></form></td>");
320 320
                             //echo("</tr>\n");
321 321
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                     $r2 = $resp[1]->value();
343 343
 
344 344
                     echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
345
-                    echo "<thead>\n<tr><th>Method</th><th>" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "</th><th>&nbsp;</th><th>&nbsp;</th></tr>\n</thead>\n<tbody>\n";
345
+                    echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th>&nbsp;</th><th>&nbsp;</th></tr>\n</thead>\n<tbody>\n";
346 346
                     $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding);
347 347
                     if ($desc == "") {
348 348
                         $desc = "-";
@@ -352,41 +352,41 @@  discard block
 block discarded – undo
352 352
                     if ($r2->kindOf() != "array") {
353 353
                         echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\">&nbsp;</td></tr>\n";
354 354
                     } else {
355
-                        foreach($r2 as $i => $x) {
355
+                        foreach ($r2 as $i => $x) {
356 356
                             $payload = "";
357 357
                             $alt_payload = "";
358
-                            if ($i + 1 % 2) {
358
+                            if ($i+1 % 2) {
359 359
                                 $class = ' class="oddrow"';
360 360
                             } else {
361 361
                                 $class = ' class="evenrow"';
362 362
                             }
363
-                            echo "<tr><td$class>Signature&nbsp;" . ($i + 1) . "</td><td$class>";
363
+                            echo "<tr><td$class>Signature&nbsp;".($i+1)."</td><td$class>";
364 364
                             if ($x->kindOf() == "array") {
365 365
                                 $ret = $x[0];
366
-                                echo "<code>OUT:&nbsp;" . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: (";
367
-                                if ($x->count() > 1) {
368
-                                    foreach($x as $k => $y) {
366
+                                echo "<code>OUT:&nbsp;".htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."<br />IN: (";
367
+                                if ($x->count()>1) {
368
+                                    foreach ($x as $k => $y) {
369 369
                                         if ($k == 0) continue;
370 370
                                         echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding);
371 371
                                         if ($wstype != 1) {
372 372
                                             $type = $y->scalarval();
373 373
                                             $payload .= '<param><value>';
374
-                                            switch($type) {
374
+                                            switch ($type) {
375 375
                                                 case 'undefined':
376 376
                                                     break;
377 377
                                                 case 'null';
378 378
                                                     $type = 'nil';
379 379
                                                     // fall thru intentionally
380 380
                                                 default:
381
-                                                    $payload .= '<' .
382
-                                                        htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
383
-                                                        '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
381
+                                                    $payload .= '<'.
382
+                                                        htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding).
383
+                                                        '></'.htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding).
384 384
                                                         '>';
385 385
                                             }
386 386
                                             $payload .= "</value></param>\n";
387 387
                                         }
388 388
                                         $alt_payload .= $y->scalarval();
389
-                                        if ($k < $x->count() - 1) {
389
+                                        if ($k<$x->count()-1) {
390 390
                                             $alt_payload .= ';';
391 391
                                             echo ", ";
392 392
                                         }
@@ -399,63 +399,63 @@  discard block
 block discarded – undo
399 399
                             echo '</td>';
400 400
                             // button to test this method
401 401
                             //$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>";
402
-                            echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" .
403
-                                "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" .
404
-                                "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" .
405
-                                "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" .
406
-                                "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" .
407
-                                "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" .
408
-                                "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" .
409
-                                "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" .
410
-                                "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" .
411
-                                "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" .
412
-                                "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" .
413
-                                "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" .
414
-                                "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" .
415
-                                "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" .
416
-                                "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" .
417
-                                "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" .
418
-                                "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" .
419
-                                "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" .
420
-                                "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" .
421
-                                "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" .
422
-                                "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" .
423
-                                "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" .
424
-                                "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" .
425
-                                "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" .
402
+                            echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">".
403
+                                "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />".
404
+                                "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />".
405
+                                "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />".
406
+                                "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />".
407
+                                "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />".
408
+                                "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />".
409
+                                "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />".
410
+                                "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />".
411
+                                "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />".
412
+                                "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />".
413
+                                "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />".
414
+                                "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />".
415
+                                "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />".
416
+                                "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />".
417
+                                "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />".
418
+                                "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />".
419
+                                "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />".
420
+                                "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />".
421
+                                "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />".
422
+                                "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />".
423
+                                "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />".
424
+                                "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />".
425
+                                "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />".
426 426
                                 "<input type=\"hidden\" name=\"action\" value=\"execute\" />";
427 427
                             if ($wstype != 1) {
428 428
                                 echo "<input type=\"submit\" value=\"Load method synopsis\" />";
429 429
                             }
430 430
                             echo "</form></td>\n";
431 431
 
432
-                            echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" .
433
-                                "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" .
434
-                                "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" .
435
-                                "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" .
436
-                                "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" .
437
-                                "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" .
438
-                                "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" .
439
-                                "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" .
440
-                                "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" .
441
-                                "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" .
442
-                                "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" .
443
-                                "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" .
444
-                                "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" .
445
-                                "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" .
446
-                                "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" .
447
-                                "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" .
448
-                                "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" .
449
-                                "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" .
450
-                                "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" .
451
-                                "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" .
452
-                                "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" .
453
-                                "<input type=\"hidden\" name=\"methodsig\" value=\"" . $i . "\" />" .
454
-                                "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" .
455
-                                "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" .
456
-                                "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" .
457
-                                "<input type=\"hidden\" name=\"run\" value=\"now\" />" .
458
-                                "<input type=\"hidden\" name=\"action\" value=\"wrap\" />" .
432
+                            echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">".
433
+                                "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />".
434
+                                "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />".
435
+                                "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />".
436
+                                "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />".
437
+                                "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />".
438
+                                "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />".
439
+                                "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />".
440
+                                "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />".
441
+                                "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />".
442
+                                "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />".
443
+                                "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />".
444
+                                "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />".
445
+                                "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />".
446
+                                "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />".
447
+                                "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />".
448
+                                "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />".
449
+                                "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />".
450
+                                "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />".
451
+                                "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />".
452
+                                "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />".
453
+                                "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />".
454
+                                "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />".
455
+                                "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />".
456
+                                "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />".
457
+                                "<input type=\"hidden\" name=\"run\" value=\"now\" />".
458
+                                "<input type=\"hidden\" name=\"action\" value=\"wrap\" />".
459 459
                                 "<input type=\"submit\" value=\"Generate method call stub code\" />";
460 460
                             echo "</form></td></tr>\n";
461 461
                         }
@@ -467,14 +467,14 @@  discard block
 block discarded – undo
467 467
                 case 'wrap':
468 468
                     $r1 = $resp[0]->value();
469 469
                     $r2 = $resp[1]->value();
470
-                    if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) {
470
+                    if ($r2->kindOf() != "array" || $r2->count()<=$methodsig) {
471 471
                         echo "Error: signature unknown\n";
472 472
                     } else {
473 473
                         $mdesc = $r1->scalarval();
474 474
                         $encoder = new PhpXmlRpc\Encoder();
475 475
                         $msig = $encoder->decode($r2);
476 476
                         $msig = $msig[$methodsig];
477
-                        $proto = $protocol == 2 ? 'https' : ( $protocol == 1 ? 'http11' : '' );
477
+                        $proto = $protocol == 2 ? 'https' : ($protocol == 1 ? 'http11' : '');
478 478
                         if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression &&
479 479
                             $clientcookies == ''
480 480
                         ) {
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
                             $prefix = 'xmlrpc';
489 489
                         }
490 490
                         $wrapper = new PhpXmlRpc\Wrapper();
491
-                        $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc);
491
+                        $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc);
492 492
                         //if ($code)
493 493
                         //{
494 494
                         echo "<div id=\"phpcode\">\n";
495
-                        highlight_string("<?php\n" . $code['docstring'] . $code['source'] . '?>');
495
+                        highlight_string("<?php\n".$code['docstring'].$code['source'].'?>');
496 496
                         echo "\n</div>";
497 497
                         //}
498 498
                         //else
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                     break;
504 504
 
505 505
                 case 'execute':
506
-                    echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>';
506
+                    echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>';
507 507
                     break;
508 508
 
509 509
                 default: // give a warning
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
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                     $this->me['struct'] = $val;
120 120
                     break;
121 121
                 default:
122
-                    $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
122
+                    $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)");
123 123
             }
124 124
         }
125 125
     }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         }
145 145
 
146 146
         if ($typeOf !== 1) {
147
-            $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
147
+            $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
148 148
             return 0;
149 149
         }
150 150
 
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 
162 162
         switch ($this->mytype) {
163 163
             case 1:
164
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
164
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
165 165
                 return 0;
166 166
             case 3:
167
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
167
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
168 168
                 return 0;
169 169
             case 2:
170 170
                 // we're adding a scalar value to an array here
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
             return 1;
208 208
         } else {
209
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
209
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
210 210
             return 0;
211 211
         }
212 212
     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
             return 1;
239 239
         } else {
240
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
240
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
241 241
             return 0;
242 242
         }
243 243
     }
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             case 1:
280 280
                 switch ($typ) {
281 281
                     case static::$xmlrpcBase64:
282
-                        $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>";
282
+                        $rs .= "<${typ}>".base64_encode($val)."</${typ}>";
283 283
                         break;
284 284
                     case static::$xmlrpcBoolean:
285
-                        $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
285
+                        $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>";
286 286
                         break;
287 287
                     case static::$xmlrpcString:
288 288
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
289
-                        $rs .= "<${typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>";
289
+                        $rs .= "<${typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>";
290 290
                         break;
291 291
                     case static::$xmlrpcInt:
292 292
                     case static::$xmlrpcI4:
293 293
                     case static::$xmlrpcI8:
294
-                        $rs .= "<${typ}>" . (int)$val . "</${typ}>";
294
+                        $rs .= "<${typ}>".(int) $val."</${typ}>";
295 295
                         break;
296 296
                     case static::$xmlrpcDouble:
297 297
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -299,16 +299,16 @@  discard block
 block discarded – undo
299 299
                         // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
300 300
                         // The code below tries its best at keeping max precision while avoiding exp notation,
301 301
                         // but there is of course no limit in the number of decimal places to be used...
302
-                        $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</${typ}>";
302
+                        $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</${typ}>";
303 303
                         break;
304 304
                     case static::$xmlrpcDateTime:
305 305
                         if (is_string($val)) {
306 306
                             $rs .= "<${typ}>${val}</${typ}>";
307 307
                         // DateTimeInterface is not present in php 5.4...
308 308
                         } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) {
309
-                            $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>";
309
+                            $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
310 310
                         } elseif (is_int($val)) {
311
-                            $rs .= "<${typ}>" . date('Ymd\TH:i:s', $val) . "</${typ}>";
311
+                            $rs .= "<${typ}>".date('Ymd\TH:i:s', $val)."</${typ}>";
312 312
                         } else {
313 313
                             // not really a good idea here: but what should we output anyway? left for backward compat...
314 314
                             $rs .= "<${typ}>${val}</${typ}>";
@@ -330,14 +330,14 @@  discard block
 block discarded – undo
330 330
             case 3:
331 331
                 // struct
332 332
                 if ($this->_php_class) {
333
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
333
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
334 334
                 } else {
335 335
                     $rs .= "<struct>\n";
336 336
                 }
337 337
                 $charsetEncoder = $this->getCharsetEncoder();
338 338
                 /** @var Value $val2 */
339 339
                 foreach ($val as $key2 => $val2) {
340
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
340
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
341 341
                     //$rs.=$this->serializeval($val2);
342 342
                     $rs .= $val2->serialize($charsetEncoding);
343 343
                     $rs .= "</member>\n";
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         $val = reset($this->me);
374 374
         $typ = key($this->me);
375 375
 
376
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
376
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
377 377
     }
378 378
 
379 379
     /**
Please login to merge, or discard this patch.
tests/PolyfillTestCase.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@
 block discarded – undo
2 2
 
3 3
 use PHPUnit\Runner\Version as PHPUnit_Version;
4 4
 
5
-if ( class_exists( 'PHPUnit_Extensions_SeleniumCommon_RemoteCoverage' ) === true
6
-    && class_exists( 'PHPUnit\Extensions\SeleniumCommon\RemoteCoverage' ) === false
5
+if (class_exists('PHPUnit_Extensions_SeleniumCommon_RemoteCoverage') === true
6
+    && class_exists('PHPUnit\Extensions\SeleniumCommon\RemoteCoverage') === false
7 7
 ) {
8
-    class_alias( 'PHPUnit_Extensions_SeleniumCommon_RemoteCoverage', 'PHPUnit\Extensions\SeleniumCommon\RemoteCoverage' );
8
+    class_alias('PHPUnit_Extensions_SeleniumCommon_RemoteCoverage', 'PHPUnit\Extensions\SeleniumCommon\RemoteCoverage');
9 9
 }
10 10
 
11
-if ( class_exists( 'PHPUnit_Runner_BaseTestRunner' ) === true
12
-    && class_exists( 'PHPUnit\Runner\BaseTestRunner' ) === false
11
+if (class_exists('PHPUnit_Runner_BaseTestRunner') === true
12
+    && class_exists('PHPUnit\Runner\BaseTestRunner') === false
13 13
 ) {
14
-    class_alias( 'PHPUnit_Runner_BaseTestRunner', 'PHPUnit\Runner\BaseTestRunner' );
14
+    class_alias('PHPUnit_Runner_BaseTestRunner', 'PHPUnit\Runner\BaseTestRunner');
15 15
 }
16 16
 
17 17
 if (class_exists('PHPUnit\Runner\Version') === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) {
18
-    include_once __DIR__ . '/PolyfillTestCase7.php';
18
+    include_once __DIR__.'/PolyfillTestCase7.php';
19 19
 } else {
20
-    include_once __DIR__ . '/PolyfillTestCase8.php';
20
+    include_once __DIR__.'/PolyfillTestCase8.php';
21 21
 }
Please login to merge, or discard this patch.