Passed
Push — master ( b73d50...e8d99c )
by Gaetano
07:04
created
src/Encoder.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
                                 'scalar' => $val,
58 58
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val)
59 59
                             );
60
-                            return (object)$xmlrpcVal;
60
+                            return (object) $xmlrpcVal;
61 61
                         case 'base64':
62 62
                             $xmlrpcVal = array(
63 63
                                 'xmlrpc_type' => 'base64',
64 64
                                 'scalar' => $val
65 65
                             );
66
-                            return (object)$xmlrpcVal;
66
+                            return (object) $xmlrpcVal;
67 67
                         case 'string':
68 68
                             if (isset($options['extension_api_encoding'])) {
69 69
                                 // if iconv is not available, we use mb_convert_encoding
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             case 'msg':
137 137
                 $paramCount = $xmlrpcVal->getNumParams();
138 138
                 $arr = array();
139
-                for ($i = 0; $i < $paramCount; $i++) {
139
+                for ($i = 0; $i<$paramCount; $i++) {
140 140
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
141 141
                 }
142 142
                 return $arr;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 break;
262 262
             case 'resource':
263 263
                 if (in_array('extension_api', $options)) {
264
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
264
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
265 265
                 } else {
266 266
                     $xmlrpcVal = new Value();
267 267
                 }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     if ($valEncoding == 'ISO-8859-1') {
311 311
                         $xmlVal = utf8_encode($xmlVal);
312 312
                     } else {
313
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
313
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
314 314
                     }
315 315
                 }
316 316
             }
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
             $_xh = $xmlRpcParser->_xh;
337 337
         }
338 338
 
339
-        if ($_xh['isf'] > 1) {
339
+        if ($_xh['isf']>1) {
340 340
             // test that $_xh['value'] is an obj, too???
341 341
 
342
-            $this->getLogger()->error('XML-RPC: ' . $_xh['isf_reason']);
342
+            $this->getLogger()->error('XML-RPC: '.$_xh['isf_reason']);
343 343
 
344 344
             return false;
345 345
         }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
             case 'methodcall':
362 362
                 $req = new Request($_xh['method']);
363
-                for ($i = 0; $i < count($_xh['params']); $i++) {
363
+                for ($i = 0; $i<count($_xh['params']); $i++) {
364 364
                     $req->addParam($_xh['params'][$i]);
365 365
                 }
366 366
                 return $req;
Please login to merge, or discard this patch.
src/Server.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -463,7 +463,7 @@
 block discarded – undo
463 463
     public function addToMap($methodName, $function, $sig = null, $doc = false, $sigDoc = false, $parametersType = false,
464 464
         $exceptionHandling = false)
465 465
     {
466
-       $this->add_to_map($methodName, $function, $sig, $doc, $sigDoc, $parametersType, $exceptionHandling);
466
+        $this->add_to_map($methodName, $function, $sig, $doc, $sigDoc, $parametersType, $exceptionHandling);
467 467
     }
468 468
 
469 469
     /**
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     public function getOptions()
252 252
     {
253 253
         $values = array();
254
-        foreach(static::$options as $opt) {
254
+        foreach (static::$options as $opt) {
255 255
             $values[$opt] = $this->getOption($opt);
256 256
         }
257 257
         return $values;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public function setOptions($options)
266 266
     {
267
-        foreach($options as $name => $value) {
267
+        foreach ($options as $name => $value) {
268 268
             $this->setOption($name, $value);
269 269
         }
270 270
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public static function xmlrpc_debugmsg($msg)
304 304
     {
305
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
305
+        static::$_xmlrpc_debuginfo .= $msg."\n";
306 306
     }
307 307
 
308 308
     /**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      */
315 315
     public static function error_occurred($msg)
316 316
     {
317
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
317
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
318 318
     }
319 319
 
320 320
     /**
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
336 336
         $out = '';
337 337
         if ($this->debug_info != '') {
338
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
338
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
339 339
         }
340 340
         if (static::$_xmlrpc_debuginfo != '') {
341
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
341
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
342 342
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
343 343
             // into return payload AFTER the beginning tag
344 344
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
         $this->debug_info = '';
368 368
 
369 369
         // Save what we received, before parsing it
370
-        if ($this->debug > 1) {
371
-            $this->debugMsg("+++GOT+++\n" . $data . "\n+++END+++");
370
+        if ($this->debug>1) {
371
+            $this->debugMsg("+++GOT+++\n".$data."\n+++END+++");
372 372
         }
373 373
 
374 374
         $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
             $resp->raw_data = $rawData;
386 386
         }
387 387
 
388
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
389
-            $this->debugMsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
390
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
388
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
389
+            $this->debugMsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
390
+                static::$_xmlrpcs_occurred_errors."+++END+++");
391 391
         }
392 392
 
393 393
         $payload = $this->generatePayload($resp, $respCharset);
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
             $numParams = count($in);
483 483
         }
484 484
         foreach ($sigs as $curSig) {
485
-            if (count($curSig) == $numParams + 1) {
485
+            if (count($curSig) == $numParams+1) {
486 486
                 $itsOK = 1;
487
-                for ($n = 0; $n < $numParams; $n++) {
487
+                for ($n = 0; $n<$numParams; $n++) {
488 488
                     if (is_object($in)) {
489 489
                         $p = $in->getParam($n);
490 490
                         if ($p->kindOf() == 'scalar') {
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
                     }
498 498
 
499 499
                     // param index is $n+1, as first member of sig is return type
500
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
500
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
501 501
                         $itsOK = 0;
502
-                        $pno = $n + 1;
503
-                        $wanted = $curSig[$n + 1];
502
+                        $pno = $n+1;
503
+                        $wanted = $curSig[$n+1];
504 504
                         $got = $pt;
505 505
                         break;
506 506
                     }
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
         // check if $_SERVER is populated: it might have been disabled via ini file
528 528
         // (this is true even when in CLI mode)
529 529
         if (count($_SERVER) == 0) {
530
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
530
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
531 531
         }
532 532
 
533
-        if ($this->debug > 1) {
533
+        if ($this->debug>1) {
534 534
             if (function_exists('getallheaders')) {
535 535
                 $this->debugMsg(''); // empty line
536 536
                 foreach (getallheaders() as $name => $val) {
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
556 556
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
557 557
                         $data = $degzdata;
558
-                        if ($this->debug > 1) {
559
-                            $this->debugMsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
558
+                        if ($this->debug>1) {
559
+                            $this->debugMsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
560 560
                         }
561 561
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
562 562
                         $data = $degzdata;
563
-                        if ($this->debug > 1) {
564
-                            $this->debugMsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
563
+                        if ($this->debug>1) {
564
+                            $this->debugMsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
565 565
                         }
566 566
                     } else {
567 567
                         $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
                     if ($reqEncoding == 'ISO-8859-1') {
650 650
                         $data = utf8_encode($data);
651 651
                     } else {
652
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding);
652
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding);
653 653
                     }
654 654
                 }
655 655
             }
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
             preg_match('/^XML error ([0-9]+)/', $_xh['isf_reason'], $matches);
684 684
             return new static::$responseClass(
685 685
                 0,
686
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
686
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
687 687
                 $_xh['isf_reason']);
688 688
         } elseif ($_xh['isf']) {
689 689
             /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs.
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
             return new static::$responseClass(
692 692
                 0,
693 693
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
694
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $_xh['isf_reason']);
694
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$_xh['isf_reason']);
695 695
         } else {
696 696
             // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle
697 697
             // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals)
@@ -701,8 +701,8 @@  discard block
 block discarded – undo
701 701
                     ($this->dmap[$_xh['method']]['parameters_type'] != 'xmlrpcvals')
702 702
                 )
703 703
             ) {
704
-                if ($this->debug > 1) {
705
-                    $this->debugMsg("\n+++PARSED+++\n" . var_export($_xh['params'], true) . "\n+++END+++");
704
+                if ($this->debug>1) {
705
+                    $this->debugMsg("\n+++PARSED+++\n".var_export($_xh['params'], true)."\n+++END+++");
706 706
                 }
707 707
 
708 708
                 return $this->execute($_xh['method'], $_xh['params'], $_xh['pt']);
@@ -710,12 +710,12 @@  discard block
 block discarded – undo
710 710
                 // build a Request object with data parsed from xml and add parameters in
711 711
                 $req = new Request($_xh['method']);
712 712
                 /// @todo for more speed, we could just pass in the array to the constructor (and loose the type validation)...
713
-                for ($i = 0; $i < count($_xh['params']); $i++) {
713
+                for ($i = 0; $i<count($_xh['params']); $i++) {
714 714
                     $req->addParam($_xh['params'][$i]);
715 715
                 }
716 716
 
717
-                if ($this->debug > 1) {
718
-                    $this->debugMsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
717
+                if ($this->debug>1) {
718
+                    $this->debugMsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
719 719
                 }
720 720
 
721 721
                 return $this->execute($req);
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
                 return new static::$responseClass(
766 766
                     0,
767 767
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
768
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
768
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
769 769
                 );
770 770
             }
771 771
         }
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
         // build string representation of function 'name'
781 781
         if (is_array($func)) {
782 782
             if (is_object($func[0])) {
783
-                $funcName = get_class($func[0]) . '->' . $func[1];
783
+                $funcName = get_class($func[0]).'->'.$func[1];
784 784
             } else {
785 785
                 $funcName = implode('::', $func);
786 786
             }
@@ -792,16 +792,16 @@  discard block
 block discarded – undo
792 792
 
793 793
         // verify that function to be invoked is in fact callable
794 794
         if (!is_callable($func)) {
795
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
795
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
796 796
             return new static::$responseClass(
797 797
                 0,
798 798
                 PhpXmlRpc::$xmlrpcerr['server_error'],
799
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
799
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
800 800
             );
801 801
         }
802 802
 
803 803
         if (isset($dmap[$methodName]['exception_handling'])) {
804
-            $exception_handling = (int)$dmap[$methodName]['exception_handling'];
804
+            $exception_handling = (int) $dmap[$methodName]['exception_handling'];
805 805
         } else {
806 806
             $exception_handling = $this->exception_handling;
807 807
         }
@@ -822,14 +822,14 @@  discard block
 block discarded – undo
822 822
                     $r = call_user_func($func, $req);
823 823
                 }
824 824
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
825
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
825
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
826 826
                     if (is_a($r, 'PhpXmlRpc\Value')) {
827 827
                         $r = new static::$responseClass($r);
828 828
                     } else {
829 829
                         $r = new static::$responseClass(
830 830
                             0,
831 831
                             PhpXmlRpc::$xmlrpcerr['server_error'],
832
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
832
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
833 833
                         );
834 834
                     }
835 835
                 }
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
                         $r = call_user_func_array($func, array($methodName, $params, $this->user_data));
845 845
                         // mimic EPI behaviour: if we get an array that looks like an error, make it an error response
846 846
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
847
-                            $r = new static::$responseClass(0, (int)$r['faultCode'], (string)$r['faultString']);
847
+                            $r = new static::$responseClass(0, (int) $r['faultCode'], (string) $r['faultString']);
848 848
                         } else {
849 849
                             // functions using EPI api should NOT return resp objects, so make sure we encode the
850 850
                             // return type correctly
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
     protected function generatePayload($resp, $respCharset)
931 931
     {
932 932
         $header = $resp->xml_header($respCharset);
933
-        if ($this->debug > 0) {
933
+        if ($this->debug>0) {
934 934
             $header .= $this->serializeDebug($respCharset);
935 935
         }
936 936
 
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
             $payload = $resp->serialize($respCharset);
943 943
         }
944 944
 
945
-        return $header . $payload;
945
+        return $header.$payload;
946 946
     }
947 947
 
948 948
     /**
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
         // if we get a warning/error that has output some text before here, then we cannot
957 957
         // add a new header. We cannot say we are sending xml, either...
958 958
         if (!headers_sent()) {
959
-            header('Content-Type: ' . $respContentType);
959
+            header('Content-Type: '.$respContentType);
960 960
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
961 961
             header("Vary: Accept-Charset");
962 962
 
@@ -979,12 +979,12 @@  discard block
 block discarded – undo
979 979
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
980 980
             // responses up to 8000 bytes
981 981
             if ($phpNoSelfCompress) {
982
-                header('Content-Length: ' . (int)strlen($payload));
982
+                header('Content-Length: '.(int) strlen($payload));
983 983
             }
984 984
         } else {
985 985
             /// @todo allow the user to easily subclass this in a way which allows the resp. headers to be already sent
986 986
             ///       by now without flagging it as an error. Possibly check for presence of Content-Type header
987
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
987
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
988 988
         }
989 989
 
990 990
         print $payload;
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
      */
1044 1044
     protected function debugMsg($string)
1045 1045
     {
1046
-        $this->debug_info .= $string . "\n";
1046
+        $this->debug_info .= $string."\n";
1047 1047
     }
1048 1048
 
1049 1049
     /**
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
                 $i++; // for error message, we count params from 1
1336 1336
                 return static::_xmlrpcs_multicall_error(new static::$responseClass(0,
1337 1337
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1338
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1338
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1339 1339
             }
1340 1340
         }
1341 1341
 
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
             }
1417 1417
         } else {
1418 1418
             $numCalls = count($req);
1419
-            for ($i = 0; $i < $numCalls; $i++) {
1419
+            for ($i = 0; $i<$numCalls; $i++) {
1420 1420
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1421 1421
             }
1422 1422
         }
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
         // From PHP 8.4 the E_STRICT constant has been deprecated and will emit deprecation notices.
1445 1445
         // PHP core and core extensions since PHP 8.0 and later do not emit E_STRICT notices at all.
1446 1446
         // On PHP 7 series before PHP 7.4, some functions conditionally emit E_STRICT notices.
1447
-        if (PHP_VERSION_ID >= 70400) {
1447
+        if (PHP_VERSION_ID>=70400) {
1448 1448
             static::error_occurred($errString);
1449 1449
         } elseif ($errCode != E_STRICT) {
1450 1450
             static::error_occurred($errString);
@@ -1485,12 +1485,12 @@  discard block
 block discarded – undo
1485 1485
      */
1486 1486
     protected function xml_header($charsetEncoding = '')
1487 1487
     {
1488
-        $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated');
1488
+        $this->logDeprecation('Method '.__METHOD__.' is deprecated');
1489 1489
 
1490 1490
         if ($charsetEncoding != '') {
1491
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
1491
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
1492 1492
         } else {
1493
-            return "<?xml version=\"1.0\"?" . ">\n";
1493
+            return "<?xml version=\"1.0\"?".">\n";
1494 1494
         }
1495 1495
     }
1496 1496
 
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
             case self::OPT_FUNCTIONS_PARAMETERS_TYPE:
1507 1507
             case self::OPT_PHPVALS_ENCODING_OPTIONS:
1508 1508
             case self::OPT_RESPONSE_CHARSET_ENCODING:
1509
-                $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
1509
+                $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
1510 1510
                 return $this->$name;
1511 1511
             case 'accepted_charset_encodings':
1512 1512
                 // manually implement the 'protected property' behaviour
@@ -1518,16 +1518,16 @@  discard block
 block discarded – undo
1518 1518
                     }
1519 1519
                 }
1520 1520
                 if ($canAccess) {
1521
-                    $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
1521
+                    $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
1522 1522
                     return $this->accepted_compression;
1523 1523
                 } else {
1524
-                    trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR);
1524
+                    trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR);
1525 1525
                 }
1526 1526
                 break;
1527 1527
             default:
1528 1528
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1529 1529
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1530
-                trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1530
+                trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1531 1531
                 $result = null;
1532 1532
                 return $result;
1533 1533
         }
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
             case self::OPT_FUNCTIONS_PARAMETERS_TYPE:
1545 1545
             case self::OPT_PHPVALS_ENCODING_OPTIONS:
1546 1546
             case self::OPT_RESPONSE_CHARSET_ENCODING:
1547
-                $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
1547
+                $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
1548 1548
                 $this->$name = $value;
1549 1549
                 break;
1550 1550
             case 'accepted_charset_encodings':
@@ -1557,16 +1557,16 @@  discard block
 block discarded – undo
1557 1557
                     }
1558 1558
                 }
1559 1559
                 if ($canAccess) {
1560
-                    $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
1560
+                    $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
1561 1561
                     $this->accepted_compression = $value;
1562 1562
                 } else {
1563
-                    trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR);
1563
+                    trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR);
1564 1564
                 }
1565 1565
                 break;
1566 1566
             default:
1567 1567
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1568 1568
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1569
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1569
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1570 1570
         }
1571 1571
     }
1572 1572
 
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
             case self::OPT_FUNCTIONS_PARAMETERS_TYPE:
1582 1582
             case self::OPT_PHPVALS_ENCODING_OPTIONS:
1583 1583
             case self::OPT_RESPONSE_CHARSET_ENCODING:
1584
-                $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
1584
+                $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
1585 1585
                 return isset($this->$name);
1586 1586
             case 'accepted_charset_encodings':
1587 1587
                 // manually implement the 'protected property' behaviour
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
                     }
1594 1594
                 }
1595 1595
                 if ($canAccess) {
1596
-                    $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
1596
+                    $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
1597 1597
                     return isset($this->accepted_compression);
1598 1598
                 }
1599 1599
                 // break through voluntarily
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
             case self::OPT_FUNCTIONS_PARAMETERS_TYPE:
1614 1614
             case self::OPT_PHPVALS_ENCODING_OPTIONS:
1615 1615
             case self::OPT_RESPONSE_CHARSET_ENCODING:
1616
-                $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
1616
+                $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
1617 1617
                 unset($this->$name);
1618 1618
                 break;
1619 1619
             case 'accepted_charset_encodings':
@@ -1626,16 +1626,16 @@  discard block
 block discarded – undo
1626 1626
                     }
1627 1627
                 }
1628 1628
                 if ($canAccess) {
1629
-                    $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
1629
+                    $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
1630 1630
                     unset($this->accepted_compression);
1631 1631
                 } else {
1632
-                    trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR);
1632
+                    trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR);
1633 1633
                 }
1634 1634
                 break;
1635 1635
             default:
1636 1636
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1637 1637
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1638
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1638
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1639 1639
         }
1640 1640
     }
1641 1641
 }
Please login to merge, or discard this patch.
demo/vardemo.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/client/_prepend.php";
2
+require_once __DIR__."/client/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc</title></head>
@@ -10,25 +10,25 @@  discard block
 block discarded – undo
10 10
 output("<p>Please note that in most cases you are better off using `new PhpXmlRpc\Encoder()->encode()` to create nested Value objects</p>\n");
11 11
 
12 12
 $v = new PhpXmlRpc\Value(1234, 'int');
13
-output("Int: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
13
+output("Int: <PRE>".htmlentities($v->serialize())."</PRE>");
14 14
 
15 15
 $v = new PhpXmlRpc\Value('Are the following characters escaped? < & >');
16
-output("String <PRE>" . htmlentities($v->serialize()) . "</PRE>");
16
+output("String <PRE>".htmlentities($v->serialize())."</PRE>");
17 17
 
18 18
 $v = new PhpXmlRpc\Value(true, 'boolean');
19
-output("Boolean: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
19
+output("Boolean: <PRE>".htmlentities($v->serialize())."</PRE>");
20 20
 
21 21
 $v = new PhpXmlRpc\Value(1234.5678, 'double');
22
-output("Double: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
22
+output("Double: <PRE>".htmlentities($v->serialize())."</PRE>");
23 23
 
24 24
 $v = new PhpXmlRpc\Value(time(), 'dateTime.iso8601');
25
-output("Datetime (from timestamp): <PRE>" . htmlentities($v->serialize()) . "</PRE>");
25
+output("Datetime (from timestamp): <PRE>".htmlentities($v->serialize())."</PRE>");
26 26
 $v = new PhpXmlRpc\Value(new DateTime(), 'dateTime.iso8601');
27
-output("Datetime (from php DateTime): <PRE>" . htmlentities($v->serialize()) . "</PRE>");
27
+output("Datetime (from php DateTime): <PRE>".htmlentities($v->serialize())."</PRE>");
28 28
 
29 29
 $v = new PhpXmlRpc\Value('hello world', 'base64');
30
-output("Base64: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
31
-output("(value of base64 string is: '" . $v->scalarVal() . "')<BR><BR>");
30
+output("Base64: <PRE>".htmlentities($v->serialize())."</PRE>");
31
+output("(value of base64 string is: '".$v->scalarVal()."')<BR><BR>");
32 32
 
33 33
 $v = new PhpXmlRpc\Value(
34 34
     array(
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     ),
42 42
     "array"
43 43
 );
44
-output("Array: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
44
+output("Array: <PRE>".htmlentities($v->serialize())."</PRE>");
45 45
 
46 46
 $v = new PhpXmlRpc\Value(
47 47
     array(
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
     ),
62 62
     "struct"
63 63
 );
64
-output("Struct: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
64
+output("Struct: <PRE>".htmlentities($v->serialize())."</PRE>");
65 65
 
66 66
 $w = new PhpXmlRpc\Value(array($v), 'array');
67
-output("Array containing a struct: <PRE>" . htmlentities($w->serialize()) . "</PRE>");
67
+output("Array containing a struct: <PRE>".htmlentities($w->serialize())."</PRE>");
68 68
 
69 69
 class MyClass
70 70
 {
@@ -76,49 +76,49 @@  discard block
 block discarded – undo
76 76
 // the public property is the only one which will be serialized. As such, it has to be of type Value
77 77
 $myObject->public = new \PhpXmlRpc\Value('a public property, wrapped');
78 78
 $w = new PhpXmlRpc\Value($myObject, 'struct');
79
-output("Struct encoding a php object: <PRE>" . htmlentities($w->serialize()) . "</PRE>");
79
+output("Struct encoding a php object: <PRE>".htmlentities($w->serialize())."</PRE>");
80 80
 
81 81
 output("<h3>Testing value serialization - xml-rpc extensions</h3>\n");
82 82
 $v = new PhpXmlRpc\Value(1234, 'i8');
83
-output("I8: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
83
+output("I8: <PRE>".htmlentities($v->serialize())."</PRE>");
84 84
 $v = new PhpXmlRpc\Value(null, 'null');
85
-output("Null: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
85
+output("Null: <PRE>".htmlentities($v->serialize())."</PRE>");
86 86
 \PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_apache_encoding = true;
87
-output("Null, alternative: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
87
+output("Null, alternative: <PRE>".htmlentities($v->serialize())."</PRE>");
88 88
 
89 89
 output("<h3>Testing value serialization - character encoding</h3>\n");
90 90
 // The greek word 'kosme'
91 91
 $v = new PhpXmlRpc\Value('κόσμε');
92
-output("Greek (default encoding): <PRE>" . htmlentities($v->serialize()) . "</PRE>");
93
-output("Greek (utf8 encoding): <PRE>" . htmlentities($v->serialize('UTF-8')) . "</PRE>");
92
+output("Greek (default encoding): <PRE>".htmlentities($v->serialize())."</PRE>");
93
+output("Greek (utf8 encoding): <PRE>".htmlentities($v->serialize('UTF-8'))."</PRE>");
94 94
 if (function_exists('mb_convert_encoding')) {
95
-    output("Greek (ISO-8859-7 encoding): <PRE>" . htmlentities($v->serialize('ISO-8859-7')) . "</PRE>");
95
+    output("Greek (ISO-8859-7 encoding): <PRE>".htmlentities($v->serialize('ISO-8859-7'))."</PRE>");
96 96
 }
97 97
 
98 98
 output("<h3>Testing request serialization</h3>\n");
99 99
 $req = new PhpXmlRpc\Request('examples.getStateName');
100 100
 $req->method('examples.getStateName');
101 101
 $req->addParam(new PhpXmlRpc\Value(42, 'int'));
102
-output("<PRE>" . htmlentities($req->serialize()) . "</PRE>");
102
+output("<PRE>".htmlentities($req->serialize())."</PRE>");
103 103
 
104 104
 output("<h3>Testing response serialization</h3>\n");
105 105
 $resp = new PhpXmlRpc\Response(new PhpXmlRpc\Value('The meaning of life'));
106
-output("<PRE>" . htmlentities($resp->serialize()) . "</PRE>");
106
+output("<PRE>".htmlentities($resp->serialize())."</PRE>");
107 107
 
108 108
 output("<h3>Testing ISO date formatting</h3><pre>\n");
109 109
 $t = time();
110 110
 $date = PhpXmlRpc\Helper\Date::iso8601Encode($t);
111 111
 output("Now is $t --> $date\n");
112
-output("Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n");
112
+output("Or in UTC, that is ".PhpXmlRpc\Helper\Date::iso8601Encode($t, 1)."\n");
113 113
 $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date);
114 114
 output("That is to say $date --> $tb\n");
115
-output("Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n");
116
-output("Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1) . "\n");
115
+output("Which comes out at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb)."\n");
116
+output("Which was the time in UTC at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1)."\n");
117 117
 output("</pre>\n");
118 118
 
119 119
 output("<h3>Testing reduced-precision formatting for doubles</h3><pre>\n");
120 120
 $v = new PhpXmlRpc\Value(1234.56789, 'double');
121 121
 \PhpXmlRpc\PhpXmlRpc::$xmlpc_double_precision = 2;
122
-output("Double, limited precision: <PRE>" . htmlentities($v->serialize()) . "</PRE>");
122
+output("Double, limited precision: <PRE>".htmlentities($v->serialize())."</PRE>");
123 123
 
124 124
 output('</body></html>');
Please login to merge, or discard this patch.
demo/server/methodProviders/functions.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
         $snv = $sno->scalarVal();
55 55
 
56 56
         // look it up in our array (zero-based)
57
-        if (isset(self::$stateNames[$snv - 1])) {
58
-            $stateName = self::$stateNames[$snv - 1];
57
+        if (isset(self::$stateNames[$snv-1])) {
58
+            $stateName = self::$stateNames[$snv-1];
59 59
         } else {
60 60
             // not there, so complain
61
-            $err = "I don't have a state for the index '" . $snv . "'";
61
+            $err = "I don't have a state for the index '".$snv."'";
62 62
         }
63 63
 
64 64
         if ($err != '') {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $s = $req->getParam(0);
133 133
         $t = $req->getParam(1);
134 134
 
135
-        return new Response(new Value($s->scalarVal() + $t->scalarVal(), Value::$xmlrpcInt));
135
+        return new Response(new Value($s->scalarVal()+$t->scalarVal(), Value::$xmlrpcInt));
136 136
     }
137 137
 
138 138
     public static $addtwodouble_sig = array(array('double', 'double', 'double'));
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         $s = $req->getParam(0);
143 143
         $t = $req->getParam(1);
144 144
 
145
-        return new Response(new Value($s->scalarVal() + $t->scalarVal(), Value::$xmlrpcDouble));
145
+        return new Response(new Value($s->scalarVal()+$t->scalarVal(), Value::$xmlrpcDouble));
146 146
     }
147 147
 
148 148
     public static $stringecho_sig = array(array('string', 'string'));
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         ///       In fact, we miss some API (or extra data) in the Request...
166 166
         //$payload = file_get_contents('php://input');
167 167
         $payload = $req->serialize(PhpXmlRpc::$xmlrpc_internalencoding);
168
-        $s = "I got the following message:\n" . $payload;
168
+        $s = "I got the following message:\n".$payload;
169 169
 
170 170
         return new Response(new Value($s));
171 171
     }
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 
239 239
         /// @todo in real life, we should check for presence of return characters to avoid header injection!
240 240
 
241
-        $msgHdr = "From: " . $mFrom->scalarVal() . "\n";
242
-        $msgHdr .= "To: " . $mTo->scalarVal() . "\n";
241
+        $msgHdr = "From: ".$mFrom->scalarVal()."\n";
242
+        $msgHdr .= "To: ".$mTo->scalarVal()."\n";
243 243
 
244 244
         if ($mCc->scalarVal() != "") {
245
-            $msgHdr .= "Cc: " . $mCc->scalarVal() . "\n";
245
+            $msgHdr .= "Cc: ".$mCc->scalarVal()."\n";
246 246
         }
247 247
         if ($mBcc->scalarVal() != "") {
248
-            $msgHdr .= "Bcc: " . $mBcc->scalarVal() . "\n";
248
+            $msgHdr .= "Bcc: ".$mBcc->scalarVal()."\n";
249 249
         }
250 250
         if ($mMime->scalarVal() != "") {
251
-            $msgHdr .= "Content-type: " . $mMime->scalarVal() . "\n";
251
+            $msgHdr .= "Content-type: ".$mMime->scalarVal()."\n";
252 252
         }
253 253
         $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0";
254 254
 
Please login to merge, or discard this patch.
demo/server/methodProviders/validator1.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
             array(Value::$xmlrpcInt, Value::$xmlrpcArray)
18 18
         ),
19 19
         "docstring" => 'This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.',
20
-        "function" => function ($req)
20
+        "function" => function($req)
21 21
         {
22 22
             $sno = $req->getParam(0);
23 23
             $numCurly = 0;
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
             array(Value::$xmlrpcInt, Value::$xmlrpcStruct)
39 39
         ),
40 40
         "docstring" => 'This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all &lt;i4&gt;s. Your handler must add the three numbers and return the result.',
41
-        "function" => function ($req)
41
+        "function" => function($req)
42 42
         {
43 43
             $sno = $req->getParam(0);
44 44
             $moe = $sno["moe"];
45 45
             $larry = $sno["larry"];
46 46
             $curly = $sno["curly"];
47
-            $num = $moe->scalarVal() + $larry->scalarVal() + $curly->scalarVal();
47
+            $num = $moe->scalarVal()+$larry->scalarVal()+$curly->scalarVal();
48 48
 
49 49
             return new Response(new Value($num, Value::$xmlrpcInt));
50 50
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             array(Value::$xmlrpcStruct, Value::$xmlrpcStruct)
56 56
         ),
57 57
         "docstring" => 'This handler takes a single parameter, a struct. Your handler must return the struct.',
58
-        "function" => function ($req)
58
+        "function" => function($req)
59 59
         {
60 60
             $sno = $req->getParam(0);
61 61
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             )
72 72
         ),
73 73
         "docstring" => 'This handler takes six parameters, and returns an array containing all the parameters.',
74
-        "function" => function ($req)
74
+        "function" => function($req)
75 75
         {
76 76
             return new Response(new Value(
77 77
                 array(
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
             array(Value::$xmlrpcString, Value::$xmlrpcArray)
93 93
         ),
94 94
         "docstring" => 'This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.',
95
-        "function" => function ($req)
95
+        "function" => function($req)
96 96
         {
97 97
             $ar = $req->getParam(0);
98 98
             $sz = $ar->count();
99 99
             $first = $ar[0];
100
-            $last = $ar[$sz - 1];
100
+            $last = $ar[$sz-1];
101 101
 
102
-            return new Response(new Value($first->scalarVal() . $last->scalarVal(), Value::$xmlrpcString));
102
+            return new Response(new Value($first->scalarVal().$last->scalarVal(), Value::$xmlrpcString));
103 103
         }
104 104
     ),
105 105
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             array(Value::$xmlrpcStruct, Value::$xmlrpcInt)
109 109
         ),
110 110
         "docstring" => 'This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.',
111
-        "function" => function ($req)
111
+        "function" => function($req)
112 112
         {
113 113
             $sno = $req->getParam(0);
114 114
             $v = $sno->scalarVal();
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             array(Value::$xmlrpcInt, Value::$xmlrpcStruct)
130 130
         ),
131 131
         "docstring" => 'This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all &lt;i4&gt;s. Your handler must add the three numbers and return the result.',
132
-        "function" => function ($req)
132
+        "function" => function($req)
133 133
         {
134 134
             $sno = $req->getParam(0);
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             $larry = $fools["larry"];
141 141
             $moe = $fools["moe"];
142 142
 
143
-            return new Response(new Value($curly->scalarVal() + $larry->scalarVal() + $moe->scalarVal(), Value::$xmlrpcInt));
143
+            return new Response(new Value($curly->scalarVal()+$larry->scalarVal()+$moe->scalarVal(), Value::$xmlrpcInt));
144 144
         }
145 145
     ),
146 146
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             array(Value::$xmlrpcStruct, Value::$xmlrpcString)
150 150
         ),
151 151
         "docstring" => 'This handler takes a single parameter, a string, that contains any number of predefined entities, namely &lt;, &gt;, &amp; \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.',
152
-        "function" => function ($req)
152
+        "function" => function($req)
153 153
         {
154 154
             $sno = $req->getParam(0);
155 155
             $str = $sno->scalarVal();
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             $ap = 0;
159 159
             $qu = 0;
160 160
             $amp = 0;
161
-            for ($i = 0; $i < strlen($str); $i++) {
161
+            for ($i = 0; $i<strlen($str); $i++) {
162 162
                 $c = substr($str, $i, 1);
163 163
                 switch ($c) {
164 164
                     case ">":
Please login to merge, or discard this patch.
tests/parse_args.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         // check for command line params (passed as env vars) vs. web page input params (passed as GET/POST)
47 47
         // Note that the only use-case for web-page mode is when this is used by benchmark.php
48 48
         if (!isset($_SERVER['REQUEST_METHOD'])) {
49
-            foreach($_SERVER as $key => $val) {
49
+            foreach ($_SERVER as $key => $val) {
50 50
                 if (array_key_exists($key, $args)) {
51 51
                     $$key = $val;
52 52
                 }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             //}
92 92
         }
93 93
         if ($HTTPURI[0] != '/') {
94
-            $HTTPURI = '/' . $HTTPURI;
94
+            $HTTPURI = '/'.$HTTPURI;
95 95
         }
96 96
         $args['HTTPURI'] = $HTTPURI;
97 97
 
@@ -105,21 +105,21 @@  discard block
 block discarded – undo
105 105
         }
106 106
 
107 107
         if (isset($HTTPSIGNOREPEER)) {
108
-            $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER;
108
+            $args['HTTPSIGNOREPEER'] = (bool) $HTTPSIGNOREPEER;
109 109
         }
110 110
 
111 111
         if (isset($HTTPSVERIFYHOST)) {
112
-            $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST;
112
+            $args['HTTPSVERIFYHOST'] = (int) $HTTPSVERIFYHOST;
113 113
         }
114 114
 
115 115
         if (isset($SSLVERSION)) {
116
-            $args['SSLVERSION'] = (int)$SSLVERSION;
116
+            $args['SSLVERSION'] = (int) $SSLVERSION;
117 117
         }
118 118
 
119 119
         if (isset($PROXYSERVER)) {
120 120
             $arr = explode(':', $PROXYSERVER);
121 121
             $args['PROXYSERVER'] = $arr[0];
122
-            if (count($arr) > 1) {
122
+            if (count($arr)>1) {
123 123
                 $args['PROXYPORT'] = $arr[1];
124 124
             } else {
125 125
                 $args['PROXYPORT'] = 8080;
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             return true;
86 86
         } else {
87
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value');
87
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value');
88 88
             return false;
89 89
         }
90 90
     }
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
         $this->logDeprecationUnlessCalledBy('serialize');
135 135
 
136 136
         if ($charsetEncoding != '') {
137
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
137
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
138 138
         } else {
139 139
             $this->content_type = 'text/xml';
140 140
         }
141 141
 
142 142
         $result = $this->xml_header($charsetEncoding);
143
-        $result .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities(
144
-                $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
143
+        $result .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities(
144
+                $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
145 145
         $result .= "<params>\n";
146 146
         foreach ($this->params as $p) {
147
-            $result .= "<param>\n" . $p->serialize($charsetEncoding) .
147
+            $result .= "<param>\n".$p->serialize($charsetEncoding).
148 148
                 "</param>\n";
149 149
         }
150 150
         $result .= "</params>\n";
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
         $this->logDeprecationUnlessCalledBy('createPayload');
165 165
 
166 166
         if ($charsetEncoding != '') {
167
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
167
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
168 168
         } else {
169
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
169
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
170 170
         }
171 171
     }
172 172
 
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS)
230 230
     {
231
-        if ($this->debug > 0) {
231
+        if ($this->debug>0) {
232 232
             $this->getLogger()->debug("---GOT---\n$data\n---END---");
233 233
         }
234 234
 
235 235
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
236 236
 
237 237
         if ($data == '') {
238
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.');
238
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.');
239 239
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
240 240
         }
241 241
 
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
         if (substr($data, 0, 4) == 'HTTP') {
244 244
             $httpParser = new Http();
245 245
             try {
246
-                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0);
246
+                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0);
247 247
             } catch (HttpException $e) {
248 248
                 // failed processing of HTTP response headers
249 249
                 // save into response obj the full payload received, for debugging
250 250
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code' => $e->statusCode()));
251
-            } catch(\Exception $e) {
251
+            } catch (\Exception $e) {
252 252
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data));
253 253
             }
254 254
         } else {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         // idea from Luca Mariano, originally in PEARified version of the lib
265 265
         $pos = strrpos($data, '</methodResponse>');
266 266
         if ($pos !== false) {
267
-            $data = substr($data, 0, $pos + 17);
267
+            $data = substr($data, 0, $pos+17);
268 268
         }
269 269
 
270 270
         // try to 'guestimate' the character encoding of the received response
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
             $data
274 274
         );
275 275
 
276
-        if ($this->debug >= 0) {
276
+        if ($this->debug>=0) {
277 277
             $this->httpResponse = $httpResponse;
278 278
         } else {
279 279
             $httpResponse = null;
280 280
         }
281 281
 
282
-        if ($this->debug > 0) {
282
+        if ($this->debug>0) {
283 283
             $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
284 284
             if ($start) {
285 285
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
286 286
                 /// @todo what if there is no end tag?
287 287
                 $end = strpos($data, '-->', $start);
288
-                $comments = substr($data, $start, $end - $start);
289
-                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t" .
290
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding));
288
+                $comments = substr($data, $start, $end-$start);
289
+                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t".
290
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding));
291 291
             }
292 292
         }
293 293
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                     if ($respEncoding == 'ISO-8859-1') {
310 310
                         $data = utf8_encode($data);
311 311
                     } else {
312
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding);
312
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding);
313 313
                     }
314 314
                 }
315 315
             }
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
             //    there could be proxies meddling with the request, or network data corruption...
340 340
 
341 341
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
342
-                PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $_xh['isf_reason'], '', $httpResponse);
342
+                PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$_xh['isf_reason'], '', $httpResponse);
343 343
 
344
-            if ($this->debug > 0) {
344
+            if ($this->debug>0) {
345 345
                 $this->getLogger()->debug($_xh['isf_reason']);
346 346
             }
347 347
         }
348 348
         // second error check: xml well-formed but not xml-rpc compliant
349 349
         elseif ($_xh['isf'] == 2) {
350 350
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
351
-                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $_xh['isf_reason'], '', $httpResponse);
351
+                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$_xh['isf_reason'], '', $httpResponse);
352 352
 
353 353
             /// @todo echo something for the user? check if it was already done by the parser...
354 354
             //if ($this->debug > 0) {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         // third error check: parsing of the response has somehow gone boink.
359 359
         /// @todo shall we omit the 2nd part of this check, since we trust the parsing code?
360 360
         ///       Either that, or check the fault results too...
361
-        elseif ($_xh['isf'] > 3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !$_xh['isf'] && !is_object($_xh['value']))) {
361
+        elseif ($_xh['isf']>3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !$_xh['isf'] && !is_object($_xh['value']))) {
362 362
             // something odd has happened and it's time to generate a client side error indicating something odd went on
363 363
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
364 364
                 '', $httpResponse
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
             /// @todo echo something for the user?
368 368
         } else {
369
-            if ($this->debug > 1) {
369
+            if ($this->debug>1) {
370 370
                 $this->getLogger()->debug(
371 371
                     "---PARSED---\n".var_export($_xh['value'], true)."\n---END---"
372 372
                 );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                 if ($errNo == 0) {
391 391
                     // FAULT returned, errno needs to reflect that
392 392
                     /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr
393
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1');
393
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1');
394 394
                     /// @todo in Encoder::decodeXML, we use PhpXmlRpc::$xmlrpcerr['invalid_return'] for this case (see
395 395
                     ///       also the todo 17 lines above)
396 396
                     $errNo = -1;
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             case '_php_class':
439 439
             case 'payload':
440 440
             case 'content_type':
441
-                $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
441
+                $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
442 442
                 return $this->$name;
443 443
             case 'httpResponse':
444 444
                 // manually implement the 'protected property' behaviour
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
                     }
451 451
                 }
452 452
                 if ($canAccess) {
453
-                    $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
453
+                    $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
454 454
                     return $this->httpResponse;
455 455
                 } else {
456
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
456
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
457 457
                 }
458 458
                 break;
459 459
             default:
460 460
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
461 461
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
462
-                trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
462
+                trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
463 463
                 $result = null;
464 464
                 return $result;
465 465
         }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             case 'debug':
474 474
             case 'payload':
475 475
             case 'content_type':
476
-                $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
476
+                $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
477 477
                 $this->$name = $value;
478 478
                 break;
479 479
             case 'httpResponse':
@@ -486,16 +486,16 @@  discard block
 block discarded – undo
486 486
                     }
487 487
                 }
488 488
                 if ($canAccess) {
489
-                    $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
489
+                    $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
490 490
                     $this->httpResponse = $value;
491 491
                 } else {
492
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
492
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
493 493
                 }
494 494
                 break;
495 495
             default:
496 496
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
497 497
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
498
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
498
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
499 499
         }
500 500
     }
501 501
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             case 'debug':
508 508
             case 'payload':
509 509
             case 'content_type':
510
-                $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
510
+                $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
511 511
                 return isset($this->$name);
512 512
             case 'httpResponse':
513 513
                 // manually implement the 'protected property' behaviour
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                     }
520 520
                 }
521 521
                 if ($canAccess) {
522
-                    $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
522
+                    $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
523 523
                     return isset($this->httpResponse);
524 524
                 }
525 525
                 // break through voluntarily
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
             case 'debug':
537 537
             case 'payload':
538 538
             case 'content_type':
539
-                $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
539
+                $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
540 540
                 unset($this->$name);
541 541
                 break;
542 542
             case 'httpResponse':
@@ -549,16 +549,16 @@  discard block
 block discarded – undo
549 549
                     }
550 550
                 }
551 551
                 if ($canAccess) {
552
-                    $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
552
+                    $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
553 553
                     unset($this->httpResponse);
554 554
                 } else {
555
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
555
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
556 556
                 }
557 557
                 break;
558 558
             default:
559 559
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
560 560
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
561
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
561
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
562 562
         }
563 563
     }
564 564
 }
Please login to merge, or discard this patch.
demo/server/server.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     }
25 25
 }
26 26
 
27
-require_once __DIR__ . "/_prepend.php";
27
+require_once __DIR__."/_prepend.php";
28 28
 
29 29
 use PhpXmlRpc\PhpXmlRpc;
30 30
 use PhpXmlRpc\Server;
Please login to merge, or discard this patch.
demo/server/legacy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
 // That is generally a good idea security-wise, but you might want to allow it in case of specific needs.
11 11
 // Look at the code in demo/server.php for an example of how to enable that.
12 12
 
13
-require_once __DIR__ . "/../../lib/xmlrpc.inc";
14
-require_once __DIR__ . "/../../lib/xmlrpcs.inc";
13
+require_once __DIR__."/../../lib/xmlrpc.inc";
14
+require_once __DIR__."/../../lib/xmlrpcs.inc";
15 15
 
16 16
 $signatures1 = include(__DIR__.'/methodProviders/functions.php');
17 17
 $signatures2 = include(__DIR__.'/methodProviders/interop.php');
Please login to merge, or discard this patch.