@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function getOptions() |
261 | 261 | { |
262 | 262 | $values = array(); |
263 | - foreach($this->options as $opt) { |
|
263 | + foreach ($this->options as $opt) { |
|
264 | 264 | $values[$opt] = $this->getOption($opt); |
265 | 265 | } |
266 | 266 | return $values; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function setOptions($options) |
275 | 275 | { |
276 | - foreach($options as $name => $value) { |
|
276 | + foreach ($options as $name => $value) { |
|
277 | 277 | $this->setOption($name, $value); |
278 | 278 | } |
279 | 279 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public static function xmlrpc_debugmsg($msg) |
314 | 314 | { |
315 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
315 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public static function error_occurred($msg) |
326 | 326 | { |
327 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
327 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
346 | 346 | $out = ''; |
347 | 347 | if ($this->debug_info != '') { |
348 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
348 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
349 | 349 | } |
350 | 350 | if (static::$_xmlrpc_debuginfo != '') { |
351 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
351 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
352 | 352 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
353 | 353 | // into return payload AFTER the beginning tag |
354 | 354 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | $this->debug_info = ''; |
378 | 378 | |
379 | 379 | // Save what we received, before parsing it |
380 | - if ($this->debug > 1) { |
|
381 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
380 | + if ($this->debug>1) { |
|
381 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -395,14 +395,14 @@ discard block |
||
395 | 395 | $resp->raw_data = $rawData; |
396 | 396 | } |
397 | 397 | |
398 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
399 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
400 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
398 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
399 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
400 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $payload = $this->xml_header($respCharset); |
404 | - if ($this->debug > 0) { |
|
405 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
404 | + if ($this->debug>0) { |
|
405 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // Do not create response serialization if it has already happened. Helps to build json magic |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if (empty($resp->payload)) { |
411 | 411 | $resp->serialize($respCharset); |
412 | 412 | } |
413 | - $payload = $payload . $resp->payload; |
|
413 | + $payload = $payload.$resp->payload; |
|
414 | 414 | |
415 | 415 | if ($returnPayload) { |
416 | 416 | return $payload; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | // if we get a warning/error that has output some text before here, then we cannot |
420 | 420 | // add a new header. We cannot say we are sending xml, either... |
421 | 421 | if (!headers_sent()) { |
422 | - header('Content-Type: ' . $resp->content_type); |
|
422 | + header('Content-Type: '.$resp->content_type); |
|
423 | 423 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
424 | 424 | header("Vary: Accept-Charset"); |
425 | 425 | |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
443 | 443 | // responses up to 8000 bytes |
444 | 444 | if ($phpNoSelfCompress) { |
445 | - header('Content-Length: ' . (int)strlen($payload)); |
|
445 | + header('Content-Length: '.(int) strlen($payload)); |
|
446 | 446 | } |
447 | 447 | } else { |
448 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
448 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | print $payload; |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | $numParams = count($in); |
509 | 509 | } |
510 | 510 | foreach ($sigs as $curSig) { |
511 | - if (count($curSig) == $numParams + 1) { |
|
511 | + if (count($curSig) == $numParams+1) { |
|
512 | 512 | $itsOK = 1; |
513 | - for ($n = 0; $n < $numParams; $n++) { |
|
513 | + for ($n = 0; $n<$numParams; $n++) { |
|
514 | 514 | if (is_object($in)) { |
515 | 515 | $p = $in->getParam($n); |
516 | 516 | if ($p->kindOf() == 'scalar') { |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | } |
524 | 524 | |
525 | 525 | // param index is $n+1, as first member of sig is return type |
526 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
526 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
527 | 527 | $itsOK = 0; |
528 | - $pno = $n + 1; |
|
529 | - $wanted = $curSig[$n + 1]; |
|
528 | + $pno = $n+1; |
|
529 | + $wanted = $curSig[$n+1]; |
|
530 | 530 | $got = $pt; |
531 | 531 | break; |
532 | 532 | } |
@@ -553,10 +553,10 @@ discard block |
||
553 | 553 | // check if $_SERVER is populated: it might have been disabled via ini file |
554 | 554 | // (this is true even when in CLI mode) |
555 | 555 | if (count($_SERVER) == 0) { |
556 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
556 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
557 | 557 | } |
558 | 558 | |
559 | - if ($this->debug > 1) { |
|
559 | + if ($this->debug>1) { |
|
560 | 560 | if (function_exists('getallheaders')) { |
561 | 561 | $this->debugmsg(''); // empty line |
562 | 562 | foreach (getallheaders() as $name => $val) { |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
582 | 582 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
583 | 583 | $data = $degzdata; |
584 | - if ($this->debug > 1) { |
|
585 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
584 | + if ($this->debug>1) { |
|
585 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
586 | 586 | } |
587 | 587 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
588 | 588 | $data = $degzdata; |
589 | - if ($this->debug > 1) { |
|
590 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
589 | + if ($this->debug>1) { |
|
590 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
591 | 591 | } |
592 | 592 | } else { |
593 | 593 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | if ($reqEncoding == 'ISO-8859-1') { |
675 | 675 | $data = utf8_encode($data); |
676 | 676 | } else { |
677 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
677 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
702 | 702 | return new Response( |
703 | 703 | 0, |
704 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
704 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
705 | 705 | $xmlRpcParser->_xh['isf_reason']); |
706 | 706 | } elseif ($xmlRpcParser->_xh['isf']) { |
707 | 707 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | return new Response( |
710 | 710 | 0, |
711 | 711 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
712 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
712 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
713 | 713 | } else { |
714 | 714 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
715 | 715 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -719,20 +719,20 @@ discard block |
||
719 | 719 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
720 | 720 | ) |
721 | 721 | ) { |
722 | - if ($this->debug > 1) { |
|
723 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
722 | + if ($this->debug>1) { |
|
723 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
727 | 727 | } else { |
728 | 728 | // build a Request object with data parsed from xml and add parameters in |
729 | 729 | $req = new Request($xmlRpcParser->_xh['method']); |
730 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
730 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
731 | 731 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
732 | 732 | } |
733 | 733 | |
734 | - if ($this->debug > 1) { |
|
735 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
734 | + if ($this->debug>1) { |
|
735 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | return $this->execute($req); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | return new Response( |
785 | 785 | 0, |
786 | 786 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
787 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
787 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
788 | 788 | ); |
789 | 789 | } |
790 | 790 | } |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | // build string representation of function 'name' |
800 | 800 | if (is_array($func)) { |
801 | 801 | if (is_object($func[0])) { |
802 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
802 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
803 | 803 | } else { |
804 | 804 | $funcName = implode('::', $func); |
805 | 805 | } |
@@ -811,23 +811,23 @@ discard block |
||
811 | 811 | |
812 | 812 | // verify that function to be invoked is in fact callable |
813 | 813 | if (!is_callable($func)) { |
814 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
814 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
815 | 815 | return new Response( |
816 | 816 | 0, |
817 | 817 | PhpXmlRpc::$xmlrpcerr['server_error'], |
818 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
818 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
819 | 819 | ); |
820 | 820 | } |
821 | 821 | |
822 | 822 | if (isset($dmap[$methodName]['exception_handling'])) { |
823 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
823 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
824 | 824 | } else { |
825 | 825 | $exception_handling = $this->exception_handling; |
826 | 826 | } |
827 | 827 | |
828 | 828 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
829 | 829 | // as part of response |
830 | - if ($this->debug > 2) { |
|
830 | + if ($this->debug>2) { |
|
831 | 831 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
832 | 832 | } |
833 | 833 | |
@@ -841,14 +841,14 @@ discard block |
||
841 | 841 | $r = call_user_func($func, $req); |
842 | 842 | } |
843 | 843 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
844 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
844 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
845 | 845 | if (is_a($r, 'PhpXmlRpc\Value')) { |
846 | 846 | $r = new Response($r); |
847 | 847 | } else { |
848 | 848 | $r = new Response( |
849 | 849 | 0, |
850 | 850 | PhpXmlRpc::$xmlrpcerr['server_error'], |
851 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
851 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
852 | 852 | ); |
853 | 853 | } |
854 | 854 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
864 | 864 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
865 | 865 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
866 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
866 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
867 | 867 | } else { |
868 | 868 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
869 | 869 | // return type correctly |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | // proper error-response |
889 | 889 | switch ($exception_handling) { |
890 | 890 | case 2: |
891 | - if ($this->debug > 2) { |
|
891 | + if ($this->debug>2) { |
|
892 | 892 | if (self::$_xmlrpcs_prev_ehandler) { |
893 | 893 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
894 | 894 | } else { |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | // proper error-response |
912 | 912 | switch ($exception_handling) { |
913 | 913 | case 2: |
914 | - if ($this->debug > 2) { |
|
914 | + if ($this->debug>2) { |
|
915 | 915 | if (self::$_xmlrpcs_prev_ehandler) { |
916 | 916 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
917 | 917 | } else { |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | } |
932 | 932 | } |
933 | 933 | |
934 | - if ($this->debug > 2) { |
|
934 | + if ($this->debug>2) { |
|
935 | 935 | // note: restore the error handler we found before calling the user func, even if it has been changed |
936 | 936 | // inside the func itself |
937 | 937 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | */ |
998 | 998 | protected function debugmsg($string) |
999 | 999 | { |
1000 | - $this->debug_info .= $string . "\n"; |
|
1000 | + $this->debug_info .= $string."\n"; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | /** |
@@ -1007,9 +1007,9 @@ discard block |
||
1007 | 1007 | protected function xml_header($charsetEncoding = '') |
1008 | 1008 | { |
1009 | 1009 | if ($charsetEncoding != '') { |
1010 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
1010 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
1011 | 1011 | } else { |
1012 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
1012 | + return "<?xml version=\"1.0\"?".">\n"; |
|
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | $i++; // for error message, we count params from 1 |
1303 | 1303 | return static::_xmlrpcs_multicall_error(new Response(0, |
1304 | 1304 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1305 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1305 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1306 | 1306 | } |
1307 | 1307 | } |
1308 | 1308 | |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | } |
1384 | 1384 | } else { |
1385 | 1385 | $numCalls = count($req); |
1386 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1386 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1387 | 1387 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1388 | 1388 | } |
1389 | 1389 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | use PhpXmlRpc\Encoder; |
5 | 5 | use PhpXmlRpc\Client; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $handles = array(); |
27 | 27 | $curl = curl_multi_init(); |
28 | 28 | |
29 | - foreach($requests as $k => $req) { |
|
29 | + foreach ($requests as $k => $req) { |
|
30 | 30 | $req->setDebug($this->debug); |
31 | 31 | |
32 | 32 | $handle = $this->prepareCurlHandle( |
@@ -59,19 +59,19 @@ discard block |
||
59 | 59 | $running = 0; |
60 | 60 | do { |
61 | 61 | curl_multi_exec($curl, $running); |
62 | - } while($running > 0); |
|
62 | + } while ($running>0); |
|
63 | 63 | |
64 | 64 | $responses = array(); |
65 | - foreach($handles as $k => $h) { |
|
65 | + foreach ($handles as $k => $h) { |
|
66 | 66 | $responses[$k] = curl_multi_getcontent($handles[$k]); |
67 | 67 | |
68 | - if ($this->debug > 1) { |
|
68 | + if ($this->debug>1) { |
|
69 | 69 | $message = "---CURL INFO---\n"; |
70 | 70 | foreach (curl_getinfo($h) as $name => $val) { |
71 | 71 | if (is_array($val)) { |
72 | 72 | $val = implode("\n", $val); |
73 | 73 | } |
74 | - $message .= $name . ': ' . $val . "\n"; |
|
74 | + $message .= $name.': '.$val."\n"; |
|
75 | 75 | } |
76 | 76 | $message .= '---END---'; |
77 | 77 | $this->getLogger()->debugMessage($message); |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | } |
83 | 83 | curl_multi_close($curl); |
84 | 84 | |
85 | - foreach($responses as $k => $resp) { |
|
85 | + foreach ($responses as $k => $resp) { |
|
86 | 86 | if (!$resp) { |
87 | - $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
87 | + $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
88 | 88 | } else { |
89 | 89 | $responses[$k] = $requests[$k]->parseResponse($resp, true, $this->return_type); |
90 | 90 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | $value = $encoder->encode($data, array('auto_dates')); |
102 | 102 | $req = new Request('interopEchoTests.echoValue', array($value)); |
103 | 103 | $reqs = array(); |
104 | -for ($i = 0; $i < $num_tests; $i++) { |
|
104 | +for ($i = 0; $i<$num_tests; $i++) { |
|
105 | 105 | $reqs[] = $req; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $client = new ParallelClient(XMLRPCSERVER); |
109 | -$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
109 | +$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
110 | 110 | |
111 | 111 | // a minimal benchmark - use 3 strategies to execute the same 25 calls: sequentially, using parallel http requests, and |
112 | 112 | // using a single system.multiCall request |
@@ -116,18 +116,18 @@ discard block |
||
116 | 116 | |
117 | 117 | $t = microtime(true); |
118 | 118 | $resp = $client->send($reqs); |
119 | -$t = microtime(true) - $t; |
|
120 | -echo "Sequential send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
119 | +$t = microtime(true)-$t; |
|
120 | +echo "Sequential send: ".sprintf('%.3f', $t)." secs.\n"; |
|
121 | 121 | flush(); |
122 | 122 | |
123 | 123 | $t = microtime(true); |
124 | 124 | $resp = $client->sendParallel($reqs); |
125 | -$t = microtime(true) - $t; |
|
126 | -echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
125 | +$t = microtime(true)-$t; |
|
126 | +echo "Parallel send: ".sprintf('%.3f', $t)." secs.\n"; |
|
127 | 127 | flush(); |
128 | 128 | |
129 | 129 | $client->setOption(Client::OPT_NO_MULTICALL, false); |
130 | 130 | $t = microtime(true); |
131 | 131 | $resp = $client->send($reqs); |
132 | -$t = microtime(true) - $t; |
|
133 | -echo "Multicall send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
132 | +$t = microtime(true)-$t; |
|
133 | +echo "Multicall send: ".sprintf('%.3f', $t)." secs.\n"; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | output('<html lang="en"> |
5 | 5 | <head><title>phpxmlrpc - Introspect demo</title></head> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function display_error($r) |
18 | 18 | { |
19 | 19 | output("An error occurred: "); |
20 | - output("Code: " . $r->faultCode() . " Reason: '" . $r->faultString() . "'<br/>"); |
|
20 | + output("Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>"); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | $client = new Client(XMLRPCSERVER); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $client->setOption(Client::OPT_RETURN_TYPE, XMLRPCParser::RETURN_PHP); |
26 | 26 | |
27 | 27 | // First off, let's retrieve the list of methods available on the remote server |
28 | -output("<h3>methods available at http://" . $client->server . $client->path . "</h3>\n"); |
|
28 | +output("<h3>methods available at http://".$client->server.$client->path."</h3>\n"); |
|
29 | 29 | $req = new Request('system.listMethods'); |
30 | 30 | $resp = $client->send($req); |
31 | 31 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // Then, retrieve the signature and help text of each available method |
49 | 49 | foreach ($v as $methodName) { |
50 | - output("<h4>" . htmlspecialchars($methodName) . "</h4>\n"); |
|
50 | + output("<h4>".htmlspecialchars($methodName)."</h4>\n"); |
|
51 | 51 | // build requests first, add params later |
52 | 52 | $r1 = new PhpXmlRpc\Request('system.methodHelp'); |
53 | 53 | $r2 = new PhpXmlRpc\Request('system.methodSignature'); |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | continue; |
84 | 84 | } |
85 | 85 | $ret = $sig[0]; |
86 | - output("<code>" . htmlspecialchars($ret) . " " |
|
87 | - . htmlspecialchars($methodName) . "("); |
|
88 | - if (count($sig) > 1) { |
|
89 | - for ($k = 1; $k < count($sig); $k++) { |
|
86 | + output("<code>".htmlspecialchars($ret)." " |
|
87 | + . htmlspecialchars($methodName)."("); |
|
88 | + if (count($sig)>1) { |
|
89 | + for ($k = 1; $k<count($sig); $k++) { |
|
90 | 90 | output(htmlspecialchars($sig[$k])); |
91 | - if ($k < count($sig) - 1) { |
|
91 | + if ($k<count($sig)-1) { |
|
92 | 92 | output(", "); |
93 | 93 | } |
94 | 94 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | output('<html lang="en"> |
5 | 5 | <head><title>phpxmlrpc - Getstatename demo</title></head> |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $stateNo = ""; |
18 | 18 | |
19 | 19 | if (isset($_POST['stateno']) && $_POST['stateno'] != "") { |
20 | - $stateNo = (integer)$_POST['stateno']; |
|
20 | + $stateNo = (integer) $_POST['stateno']; |
|
21 | 21 | $method = 'examples.getStateName'; |
22 | 22 | $arguments = array( |
23 | 23 | new Value($stateNo, Value::$xmlrpcInt), |
24 | 24 | ); |
25 | 25 | $req = new Request($method, $arguments); |
26 | - output("Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . |
|
26 | + output("Sending the following request:<pre>\n\n".htmlentities($req->serialize()). |
|
27 | 27 | "\n\n</pre>Debug info of server data follows...\n\n"); |
28 | 28 | $client = new Client(XMLRPCSERVER); |
29 | 29 | $client->setOption(Client::OPT_DEBUG, 1); |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | $val = $resp->value(); |
33 | 33 | // NB: we are _assuming_ that the server did return a scalar xml-rpc value here. |
34 | 34 | // If the server is not trusted, we might check that via `$val->kindOf() == 'scalar'` |
35 | - output('<br/>State number <b>' . $stateNo . '</b> is <b>' |
|
36 | - . htmlspecialchars($val->scalarval()) . '</b><br/><br/>'); |
|
35 | + output('<br/>State number <b>'.$stateNo.'</b> is <b>' |
|
36 | + . htmlspecialchars($val->scalarval()).'</b><br/><br/>'); |
|
37 | 37 | } else { |
38 | 38 | output('An error occurred: '); |
39 | - output('<pre>Code: ' . htmlspecialchars($resp->faultCode()) |
|
40 | - . " Reason: '" . htmlspecialchars($resp->faultString()) . "'</pre>"); |
|
39 | + output('<pre>Code: '.htmlspecialchars($resp->faultCode()) |
|
40 | + . " Reason: '".htmlspecialchars($resp->faultString())."'</pre>"); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | output('<html lang="en"> |
5 | 5 | <head><title>phpxmlrpc - Webservice wrapper demo</title></head> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $client->setOption(\PhpXmlRpc\Client::OPT_RETURN_TYPE, 'phpvals'); // let client give us back php values instead of xmlrpcvals |
21 | 21 | $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); |
22 | 22 | if ($resp->faultCode()) { |
23 | - output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n"); |
|
23 | + output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n"); |
|
24 | 24 | } else { |
25 | 25 | output("<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"); |
26 | 26 | flush(); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | if ($methodName == 'examples.getStateName') { |
33 | 33 | $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); |
34 | 34 | if ($callable) { |
35 | - output("<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n"); |
|
35 | + output("<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n"); |
|
36 | 36 | } else { |
37 | - output("<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n"); |
|
37 | + output("<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n"); |
|
38 | 38 | } |
39 | 39 | break; |
40 | 40 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
5 | 5 | |
@@ -25,33 +25,33 @@ discard block |
||
25 | 25 | // generate a file with a class definition |
26 | 26 | |
27 | 27 | // the generated code does not have an autoloader included - we need to add in one |
28 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
28 | +$autoloader = __DIR__."/_prepend.php"; |
|
29 | 29 | |
30 | 30 | file_put_contents($targetClassFile, |
31 | - "<?php\n\n" . |
|
32 | - "require_once '$autoloader';\n\n" . |
|
31 | + "<?php\n\n". |
|
32 | + "require_once '$autoloader';\n\n". |
|
33 | 33 | "class MyServerClass\n{\n\n" |
34 | 34 | ) || die('uh oh'); |
35 | 35 | |
36 | 36 | // we mangle a bit the code we get from wrapPhpClass to generate a php class instead of a bunch of functions |
37 | 37 | |
38 | -foreach($code as $methodName => $methodDef) { |
|
39 | - file_put_contents($targetClassFile, ' ' . str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source']) . "\n\n", FILE_APPEND) || die('uh oh'); |
|
40 | - $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function']; |
|
38 | +foreach ($code as $methodName => $methodDef) { |
|
39 | + file_put_contents($targetClassFile, ' '.str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source'])."\n\n", FILE_APPEND) || die('uh oh'); |
|
40 | + $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function']; |
|
41 | 41 | unset($code[$methodName]['source']); |
42 | 42 | } |
43 | 43 | file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh'); |
44 | 44 | |
45 | 45 | // generate separate files with the xml-rpc server instantiation and its dispatch map |
46 | 46 | |
47 | -file_put_contents($targetDispatchMapFile, "<?php\n\nreturn " . var_export($code, true) . ";\n"); |
|
47 | +file_put_contents($targetDispatchMapFile, "<?php\n\nreturn ".var_export($code, true).";\n"); |
|
48 | 48 | |
49 | 49 | file_put_contents($targetControllerFile, |
50 | - "<?php\n\n" . |
|
50 | + "<?php\n\n". |
|
51 | 51 | |
52 | - "require_once '$autoloader';\n\n" . |
|
52 | + "require_once '$autoloader';\n\n". |
|
53 | 53 | |
54 | - "require_once '$targetClassFile';\n\n" . |
|
54 | + "require_once '$targetClassFile';\n\n". |
|
55 | 55 | |
56 | 56 | // NB: since we are running the generated code within the same script, the existing CommentManager instance will be |
57 | 57 | // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | // Wrapper::holdObject('xmlrpc_CommentManager_addComment', $cm); |
62 | 62 | // Wrapper::holdObject('xmlrpc_CommentManager_getComments', $cm); |
63 | 63 | |
64 | - "\$dm = require_once '$targetDispatchMapFile';\n" . |
|
65 | - '$s = new \PhpXmlRpc\Server($dm, false);' . "\n" . |
|
66 | - '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!' . "\n" . |
|
67 | - '$s->setOption(\PhpXmlRpc\Server::OPT_DEBUG, 2);' . "\n" . |
|
68 | - '$s->setOption(\PhpXmlRpc\Server::OPT_EXCEPTION_HANDLING, 1);' . "\n" . |
|
69 | - '$s->service();' . "\n" |
|
64 | + "\$dm = require_once '$targetDispatchMapFile';\n". |
|
65 | + '$s = new \PhpXmlRpc\Server($dm, false);'."\n". |
|
66 | + '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!'."\n". |
|
67 | + '$s->setOption(\PhpXmlRpc\Server::OPT_DEBUG, 2);'."\n". |
|
68 | + '$s->setOption(\PhpXmlRpc\Server::OPT_EXCEPTION_HANDLING, 1);'."\n". |
|
69 | + '$s->service();'."\n" |
|
70 | 70 | ) || die('uh oh'); |
71 | 71 | |
72 | 72 | // test that everything worked by running it in realtime (note that this will return an xml-rpc error message if run |
@@ -57,13 +57,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
310 | 310 | if ($valEncoding == 'ISO-8859-1') { |
311 | 311 | $xmlVal = utf8_encode($xmlVal); |
312 | 312 | } else { |
313 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
313 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | $parserOptions |
333 | 333 | ); |
334 | 334 | |
335 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
335 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
336 | 336 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
337 | 337 | |
338 | - $this->getLogger()->error('XML-RPC: ' . $xmlRpcParser->_xh['isf_reason']); |
|
338 | + $this->getLogger()->error('XML-RPC: '.$xmlRpcParser->_xh['isf_reason']); |
|
339 | 339 | |
340 | 340 | return false; |
341 | 341 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | case 'methodcall': |
358 | 358 | $req = new Request($xmlRpcParser->_xh['method']); |
359 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
359 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
360 | 360 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
361 | 361 | } |
362 | 362 | return $req; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // user declares the type of resp value: we "almost" trust it... but log errors just in case |
74 | 74 | if (($this->valtyp == 'xmlrpcvals' && (!is_a($this->val, 'PhpXmlRpc\Value'))) || |
75 | 75 | ($this->valtyp == 'xml' && (!is_string($this->val)))) { |
76 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in does not match type ' . $valType); |
|
76 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in does not match type '.$valType); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
@@ -152,33 +152,33 @@ discard block |
||
152 | 152 | public function serialize($charsetEncoding = '') |
153 | 153 | { |
154 | 154 | if ($charsetEncoding != '') { |
155 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
155 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
156 | 156 | } else { |
157 | 157 | $this->content_type = 'text/xml'; |
158 | 158 | } |
159 | 159 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
160 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
160 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
161 | 161 | } else { |
162 | 162 | $result = "<methodResponse>\n"; |
163 | 163 | } |
164 | 164 | if ($this->errno) { |
165 | 165 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
166 | - $result .= "<fault>\n" . |
|
167 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
168 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
169 | - $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . |
|
166 | + $result .= "<fault>\n". |
|
167 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
168 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
169 | + $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding). |
|
170 | 170 | "</string></value>\n</member>\n</struct>\n</value>\n</fault>"; |
171 | 171 | } else { |
172 | 172 | if (is_object($this->val) && is_a($this->val, 'PhpXmlRpc\Value')) { |
173 | - $result .= "<params>\n<param>\n" . $this->val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
173 | + $result .= "<params>\n<param>\n".$this->val->serialize($charsetEncoding)."</param>\n</params>"; |
|
174 | 174 | } else if (is_string($this->val) && $this->valtyp == 'xml') { |
175 | - $result .= "<params>\n<param>\n" . |
|
176 | - $this->val . |
|
175 | + $result .= "<params>\n<param>\n". |
|
176 | + $this->val. |
|
177 | 177 | "</param>\n</params>"; |
178 | 178 | } else if ($this->valtyp == 'phpvals') { |
179 | 179 | $encoder = new Encoder(); |
180 | 180 | $val = $encoder->encode($this->val); |
181 | - $result .= "<params>\n<param>\n" . $val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
181 | + $result .= "<params>\n<param>\n".$val->serialize($charsetEncoding)."</param>\n</params>"; |
|
182 | 182 | } else { |
183 | 183 | throw new StateErrorException('cannot serialize xmlrpc response objects whose content is native php values'); |
184 | 184 | } |
@@ -196,18 +196,18 @@ discard block |
||
196 | 196 | { |
197 | 197 | switch ($name) { |
198 | 198 | case 'hdrs': |
199 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
199 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
200 | 200 | return $this->httpResponse['headers']; |
201 | 201 | case '_cookies': |
202 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
202 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
203 | 203 | return $this->httpResponse['cookies']; |
204 | 204 | case 'raw_data': |
205 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
205 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
206 | 206 | return $this->httpResponse['raw_data']; |
207 | 207 | default: |
208 | 208 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
209 | 209 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
210 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
210 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
211 | 211 | return null; |
212 | 212 | } |
213 | 213 | } |
@@ -216,21 +216,21 @@ discard block |
||
216 | 216 | { |
217 | 217 | switch ($name) { |
218 | 218 | case 'hdrs': |
219 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
219 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
220 | 220 | $this->httpResponse['headers'] = $value; |
221 | 221 | break; |
222 | 222 | case '_cookies': |
223 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
223 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
224 | 224 | $this->httpResponse['cookies'] = $value; |
225 | 225 | break; |
226 | 226 | case 'raw_data': |
227 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
227 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
228 | 228 | $this->httpResponse['raw_data'] = $value; |
229 | 229 | break; |
230 | 230 | default: |
231 | 231 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
232 | 232 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
233 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
233 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | { |
239 | 239 | switch ($name) { |
240 | 240 | case 'hdrs': |
241 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
241 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
242 | 242 | return isset($this->httpResponse['headers']); |
243 | 243 | case '_cookies': |
244 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
244 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
245 | 245 | return isset($this->httpResponse['cookies']); |
246 | 246 | case 'raw_data': |
247 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
247 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
248 | 248 | return isset($this->httpResponse['raw_data']); |
249 | 249 | default: |
250 | 250 | return false; |
@@ -255,21 +255,21 @@ discard block |
||
255 | 255 | { |
256 | 256 | switch ($name) { |
257 | 257 | case 'hdrs': |
258 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
258 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
259 | 259 | unset($this->httpResponse['headers']); |
260 | 260 | break; |
261 | 261 | case '_cookies': |
262 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
262 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
263 | 263 | unset($this->httpResponse['cookies']); |
264 | 264 | break; |
265 | 265 | case 'raw_data': |
266 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
266 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
267 | 267 | unset($this->httpResponse['raw_data']); |
268 | 268 | break; |
269 | 269 | default: |
270 | 270 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
271 | 271 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
272 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
272 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->me['struct'] = $val; |
97 | 97 | break; |
98 | 98 | default: |
99 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
99 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($typeOf !== 1) { |
129 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
129 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | |
144 | 144 | switch ($this->mytype) { |
145 | 145 | case 1: |
146 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
146 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
147 | 147 | return 0; |
148 | 148 | case 3: |
149 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
149 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
150 | 150 | return 0; |
151 | 151 | case 2: |
152 | 152 | // we're adding a scalar value to an array here |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | return 1; |
192 | 192 | } else { |
193 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
193 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
194 | 194 | return 0; |
195 | 195 | } |
196 | 196 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | return 1; |
223 | 223 | } else { |
224 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
224 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
225 | 225 | return 0; |
226 | 226 | } |
227 | 227 | } |
@@ -265,19 +265,19 @@ discard block |
||
265 | 265 | case 1: |
266 | 266 | switch ($typ) { |
267 | 267 | case static::$xmlrpcBase64: |
268 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
268 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
269 | 269 | break; |
270 | 270 | case static::$xmlrpcBoolean: |
271 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
271 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
272 | 272 | break; |
273 | 273 | case static::$xmlrpcString: |
274 | 274 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
275 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
275 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
276 | 276 | break; |
277 | 277 | case static::$xmlrpcInt: |
278 | 278 | case static::$xmlrpcI4: |
279 | 279 | case static::$xmlrpcI8: |
280 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
280 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
281 | 281 | break; |
282 | 282 | case static::$xmlrpcDouble: |
283 | 283 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -285,16 +285,16 @@ discard block |
||
285 | 285 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
286 | 286 | // The code below tries its best at keeping max precision while avoiding exp notation, |
287 | 287 | // but there is of course no limit in the number of decimal places to be used... |
288 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
288 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
289 | 289 | break; |
290 | 290 | case static::$xmlrpcDateTime: |
291 | 291 | if (is_string($val)) { |
292 | 292 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
293 | 293 | // DateTimeInterface is not present in php 5.4... |
294 | 294 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
295 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
295 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
296 | 296 | } elseif (is_int($val)) { |
297 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
297 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
298 | 298 | } else { |
299 | 299 | // not really a good idea here: but what should we output anyway? left for backward compat... |
300 | 300 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -316,14 +316,14 @@ discard block |
||
316 | 316 | case 3: |
317 | 317 | // struct |
318 | 318 | if ($this->_php_class) { |
319 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
319 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
320 | 320 | } else { |
321 | 321 | $rs .= "<struct>\n"; |
322 | 322 | } |
323 | 323 | $charsetEncoder = $this->getCharsetEncoder(); |
324 | 324 | /** @var Value $val2 */ |
325 | 325 | foreach ($val as $key2 => $val2) { |
326 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
326 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
327 | 327 | //$rs.=$this->serializeval($val2); |
328 | 328 | $rs .= $val2->serialize($charsetEncoding); |
329 | 329 | $rs .= "</member>\n"; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $val = reset($this->me); |
359 | 359 | $typ = key($this->me); |
360 | 360 | |
361 | - return '<value>' . $this->serializeData($typ, $val, $charsetEncoding) . "</value>\n"; |
|
361 | + return '<value>'.$this->serializeData($typ, $val, $charsetEncoding)."</value>\n"; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function structMemExists($key) |
375 | 375 | { |
376 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
376 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
377 | 377 | |
378 | 378 | return array_key_exists($key, $this->me['struct']); |
379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public function structMem($key) |
391 | 391 | { |
392 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
392 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
393 | 393 | |
394 | 394 | return $this->me['struct'][$key]; |
395 | 395 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function structReset() |
404 | 404 | { |
405 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
405 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
406 | 406 | |
407 | 407 | reset($this->me['struct']); |
408 | 408 | } |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function structEach() |
419 | 419 | { |
420 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
420 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
421 | 421 | |
422 | 422 | return @each($this->me['struct']); |
423 | 423 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function arrayMem($key) |
464 | 464 | { |
465 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
465 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
466 | 466 | |
467 | 467 | return $this->me['array'][$key]; |
468 | 468 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function arraySize() |
478 | 478 | { |
479 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
479 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
480 | 480 | |
481 | 481 | return count($this->me['array']); |
482 | 482 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function structSize() |
492 | 492 | { |
493 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
493 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
494 | 494 | |
495 | 495 | return count($this->me['struct']); |
496 | 496 | } |