@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | public function xml_header($charsetEncoding = '') |
89 | 89 | { |
90 | 90 | if ($charsetEncoding != '') { |
91 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
91 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
92 | 92 | } else { |
93 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
93 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | public function createPayload($charsetEncoding = '') |
111 | 111 | { |
112 | 112 | if ($charsetEncoding != '') { |
113 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
113 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
114 | 114 | } else { |
115 | 115 | $this->content_type = 'text/xml'; |
116 | 116 | } |
117 | 117 | $this->payload = $this->xml_header($charsetEncoding); |
118 | - $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
119 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
118 | + $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
119 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
120 | 120 | $this->payload .= "<params>\n"; |
121 | 121 | foreach ($this->params as $p) { |
122 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
122 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
123 | 123 | "</param>\n"; |
124 | 124 | } |
125 | 125 | $this->payload .= "</params>\n"; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
247 | 247 | |
248 | 248 | if ($data == '') { |
249 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
249 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
250 | 250 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
251 | 251 | } |
252 | 252 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $httpParser = new Http(); |
256 | 256 | try { |
257 | 257 | $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug); |
258 | - } catch(\Exception $e) { |
|
258 | + } catch (\Exception $e) { |
|
259 | 259 | $r = new Response(0, $e->getCode(), $e->getMessage()); |
260 | 260 | // failed processing of HTTP response headers |
261 | 261 | // save into response obj the full payload received, for debugging |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
275 | 275 | $pos = strrpos($data, '</methodResponse>'); |
276 | 276 | if ($pos !== false) { |
277 | - $data = substr($data, 0, $pos + 17); |
|
277 | + $data = substr($data, 0, $pos+17); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // try to 'guestimate' the character encoding of the received response |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | if ($start) { |
286 | 286 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
287 | 287 | $end = strpos($data, '-->', $start); |
288 | - $comments = substr($data, $start, $end - $start); |
|
289 | - $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
290 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
288 | + $comments = substr($data, $start, $end-$start); |
|
289 | + $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
290 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (extension_loaded('mbstring')) { |
316 | 316 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
317 | 317 | } else { |
318 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
318 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | } |
@@ -336,12 +336,12 @@ discard block |
||
336 | 336 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE, $options); |
337 | 337 | |
338 | 338 | // first error check: xml not well formed |
339 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
339 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
340 | 340 | |
341 | 341 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
342 | 342 | |
343 | 343 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
344 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
344 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
345 | 345 | |
346 | 346 | if ($this->debug) { |
347 | 347 | print $xmlRpcParser->_xh['isf_reason']; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | // second error check: xml well formed but not xml-rpc compliant |
351 | 351 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
352 | 352 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
353 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
353 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
354 | 354 | |
355 | 355 | if ($this->debug) { |
356 | 356 | /// @todo echo something for user? |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
366 | 366 | PhpXmlRpc::$xmlrpcstr['invalid_return']); |
367 | 367 | } else { |
368 | - if ($this->debug > 1) { |
|
368 | + if ($this->debug>1) { |
|
369 | 369 | $this->getLogger()->debugMessage( |
370 | 370 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
371 | 371 | ); |
@@ -182,20 +182,20 @@ discard block |
||
182 | 182 | $callable = explode('::', $callable); |
183 | 183 | } |
184 | 184 | if (is_array($callable)) { |
185 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
185 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | if (is_string($callable[0])) { |
190 | 190 | $plainFuncName = implode('::', $callable); |
191 | 191 | } elseif (is_object($callable[0])) { |
192 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
192 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
193 | 193 | } |
194 | 194 | $exists = method_exists($callable[0], $callable[1]); |
195 | 195 | } else if ($callable instanceof \Closure) { |
196 | 196 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
197 | 197 | if (!$buildIt) { |
198 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
198 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | if (!$exists) { |
210 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
210 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | |
@@ -251,23 +251,23 @@ discard block |
||
251 | 251 | if (is_array($callable)) { |
252 | 252 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
253 | 253 | if ($func->isPrivate()) { |
254 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
254 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | if ($func->isProtected()) { |
258 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
258 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | if ($func->isConstructor()) { |
262 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
262 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | if ($func->isDestructor()) { |
266 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
266 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | if ($func->isAbstract()) { |
270 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
270 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | /// @todo add more checks for static vs. nonstatic? |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | if ($func->isInternal()) { |
278 | 278 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
279 | 279 | // instead of getparameters to fully reflect internal php functions ? |
280 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
280 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $i = 0; |
330 | 330 | foreach ($func->getParameters() as $paramObj) { |
331 | 331 | $params[$i] = array(); |
332 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
332 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
333 | 333 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
334 | 334 | $i++; |
335 | 335 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // build a signature |
395 | 395 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
396 | 396 | $pSig = array($funcDesc['returnsDocs']); |
397 | - for ($i = 0; $i < count($pars); $i++) { |
|
397 | + for ($i = 0; $i<count($pars); $i++) { |
|
398 | 398 | $name = strtolower($funcDesc['params'][$i]['name']); |
399 | 399 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
400 | 400 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | } |
450 | 450 | } |
451 | 451 | $numPars = $req->getNumParams(); |
452 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
452 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
453 | 453 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
454 | 454 | } |
455 | 455 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | $result = call_user_func_array($callable, $params); |
464 | 464 | |
465 | - if (! is_a($result, $responseClass)) { |
|
465 | + if (!is_a($result, $responseClass)) { |
|
466 | 466 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
467 | 467 | $result = new $valueClass($result, $funcDesc['returns']); |
468 | 468 | } else { |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | if ($newFuncName == '') { |
498 | 498 | if (is_array($callable)) { |
499 | 499 | if (is_string($callable[0])) { |
500 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
500 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
501 | 501 | } else { |
502 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
502 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
503 | 503 | } |
504 | 504 | } else { |
505 | 505 | if ($callable instanceof \Closure) { |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | { |
536 | 536 | $namespace = '\\PhpXmlRpc\\'; |
537 | 537 | |
538 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
539 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
538 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
539 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
540 | 540 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
541 | 541 | |
542 | 542 | $i = 0; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | // build body of new function |
572 | 572 | |
573 | 573 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
574 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
574 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
575 | 575 | |
576 | 576 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
577 | 577 | if ($decodePhpObjects) { |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | if (is_array($callable) && is_object($callable[0])) { |
586 | 586 | self::$objHolder[$newFuncName] = $callable[0]; |
587 | 587 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
588 | - $realFuncName = '$obj->' . $callable[1]; |
|
588 | + $realFuncName = '$obj->'.$callable[1]; |
|
589 | 589 | } else { |
590 | 590 | $realFuncName = $plainFuncName; |
591 | 591 | } |
592 | 592 | foreach ($parsVariations as $i => $pars) { |
593 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
594 | - if ($i < (count($parsVariations) - 1)) |
|
593 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
594 | + if ($i<(count($parsVariations)-1)) |
|
595 | 595 | $innerCode .= "else\n"; |
596 | 596 | } |
597 | 597 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | // if($func->returnsReference()) |
609 | 609 | // return false; |
610 | 610 | |
611 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
611 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
612 | 612 | |
613 | 613 | return $code; |
614 | 614 | } |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | if ($methodWrap) { |
646 | 646 | if (is_object($className)) { |
647 | 647 | $realClassName = get_class($className); |
648 | - }else { |
|
648 | + } else { |
|
649 | 649 | $realClassName = $className; |
650 | 650 | } |
651 | 651 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -746,21 +746,21 @@ discard block |
||
746 | 746 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
747 | 747 | { |
748 | 748 | $namespace = '\\PhpXmlRpc\\'; |
749 | - $reqClass = $namespace . 'Request'; |
|
750 | - $valClass = $namespace . 'Value'; |
|
751 | - $decoderClass = $namespace . 'Encoder'; |
|
749 | + $reqClass = $namespace.'Request'; |
|
750 | + $valClass = $namespace.'Value'; |
|
751 | + $decoderClass = $namespace.'Encoder'; |
|
752 | 752 | |
753 | 753 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
754 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
754 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
755 | 755 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
756 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
756 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
757 | 757 | |
758 | 758 | $req = new $reqClass('system.methodSignature'); |
759 | 759 | $req->addparam(new $valClass($methodName)); |
760 | 760 | $client->setDebug($debug); |
761 | 761 | $response = $client->send($req, $timeout, $protocol); |
762 | 762 | if ($response->faultCode()) { |
763 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
763 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
764 | 764 | return false; |
765 | 765 | } |
766 | 766 | |
@@ -770,8 +770,8 @@ discard block |
||
770 | 770 | $mSig = $decoder->decode($mSig); |
771 | 771 | } |
772 | 772 | |
773 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
774 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
773 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
774 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
775 | 775 | return false; |
776 | 776 | } |
777 | 777 | |
@@ -787,11 +787,11 @@ discard block |
||
787 | 787 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
788 | 788 | { |
789 | 789 | $namespace = '\\PhpXmlRpc\\'; |
790 | - $reqClass = $namespace . 'Request'; |
|
791 | - $valClass = $namespace . 'Value'; |
|
790 | + $reqClass = $namespace.'Request'; |
|
791 | + $valClass = $namespace.'Value'; |
|
792 | 792 | |
793 | 793 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
794 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
794 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
795 | 795 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
796 | 796 | |
797 | 797 | $mDesc = ''; |
@@ -825,10 +825,10 @@ discard block |
||
825 | 825 | $clientClone = clone $client; |
826 | 826 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
827 | 827 | { |
828 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
828 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
829 | 829 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
830 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
831 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
830 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
831 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
832 | 832 | if (isset($extraOptions['return_on_fault'])) { |
833 | 833 | $decodeFault = true; |
834 | 834 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -837,9 +837,9 @@ discard block |
||
837 | 837 | } |
838 | 838 | |
839 | 839 | $namespace = '\\PhpXmlRpc\\'; |
840 | - $reqClass = $namespace . 'Request'; |
|
841 | - $encoderClass = $namespace . 'Encoder'; |
|
842 | - $valueClass = $namespace . 'Value'; |
|
840 | + $reqClass = $namespace.'Request'; |
|
841 | + $encoderClass = $namespace.'Encoder'; |
|
842 | + $valueClass = $namespace.'Value'; |
|
843 | 843 | |
844 | 844 | $encoder = new $encoderClass(); |
845 | 845 | $encodeOptions = array(); |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | } |
863 | 863 | |
864 | 864 | $xmlrpcArgs = array(); |
865 | - foreach($currentArgs as $i => $arg) { |
|
865 | + foreach ($currentArgs as $i => $arg) { |
|
866 | 866 | if ($i == $maxArgs) { |
867 | 867 | break; |
868 | 868 | } |
@@ -910,13 +910,13 @@ discard block |
||
910 | 910 | * @param string $mDesc |
911 | 911 | * @return string[] keys: source, docstring |
912 | 912 | */ |
913 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
913 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
914 | 914 | { |
915 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
915 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
916 | 916 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
917 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
918 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
919 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
917 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
918 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
919 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
920 | 920 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
921 | 921 | if (isset($extraOptions['return_on_fault'])) { |
922 | 922 | $decodeFault = true; |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | $namespace = '\\PhpXmlRpc\\'; |
930 | 930 | |
931 | 931 | $code = "function $newFuncName ("; |
932 | - if ($clientCopyMode < 2) { |
|
932 | + if ($clientCopyMode<2) { |
|
933 | 933 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
934 | 934 | $verbatimClientCopy = !$clientCopyMode; |
935 | 935 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | |
945 | 945 | if ($mDesc != '') { |
946 | 946 | // take care that PHP comment is not terminated unwillingly by method description |
947 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
947 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
948 | 948 | } else { |
949 | 949 | $mDesc = "/**\nFunction $newFuncName\n"; |
950 | 950 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
954 | 954 | $plist = array(); |
955 | 955 | $pCount = count($mSig); |
956 | - for ($i = 1; $i < $pCount; $i++) { |
|
956 | + for ($i = 1; $i<$pCount; $i++) { |
|
957 | 957 | $plist[] = "\$p$i"; |
958 | 958 | $pType = $mSig[$i]; |
959 | 959 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -969,19 +969,19 @@ discard block |
||
969 | 969 | } |
970 | 970 | } |
971 | 971 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
972 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
972 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
973 | 973 | } |
974 | - if ($clientCopyMode < 2) { |
|
974 | + if ($clientCopyMode<2) { |
|
975 | 975 | $plist[] = '$debug=0'; |
976 | 976 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
977 | 977 | } |
978 | 978 | $plist = implode(', ', $plist); |
979 | - $mDesc .= '* @return {$namespace}Response|' . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
979 | + $mDesc .= '* @return {$namespace}Response|'.$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
980 | 980 | |
981 | 981 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
982 | 982 | if ($decodeFault) { |
983 | 983 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
984 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
984 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
985 | 985 | } else { |
986 | 986 | $respCode = var_export($faultResponse, true); |
987 | 987 | } |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
995 | 995 | } |
996 | 996 | |
997 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
997 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
998 | 998 | |
999 | 999 | return array('source' => $code, 'docstring' => $mDesc); |
1000 | 1000 | } |
@@ -1020,23 +1020,23 @@ discard block |
||
1020 | 1020 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
1021 | 1021 | { |
1022 | 1022 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
1023 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
1023 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
1024 | 1024 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1025 | 1025 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1026 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1027 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1026 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1027 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1028 | 1028 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1029 | 1029 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1030 | 1030 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1031 | 1031 | $namespace = '\\PhpXmlRpc\\'; |
1032 | 1032 | |
1033 | - $reqClass = $namespace . 'Request'; |
|
1034 | - $decoderClass = $namespace . 'Encoder'; |
|
1033 | + $reqClass = $namespace.'Request'; |
|
1034 | + $decoderClass = $namespace.'Encoder'; |
|
1035 | 1035 | |
1036 | 1036 | $req = new $reqClass('system.listMethods'); |
1037 | 1037 | $response = $client->send($req, $timeout, $protocol); |
1038 | 1038 | if ($response->faultCode()) { |
1039 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1039 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1040 | 1040 | |
1041 | 1041 | return false; |
1042 | 1042 | } else { |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | $mList = $decoder->decode($mList); |
1047 | 1047 | } |
1048 | 1048 | if (!is_array($mList) || !count($mList)) { |
1049 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1049 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1050 | 1050 | |
1051 | 1051 | return false; |
1052 | 1052 | } else { |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | if ($newClassName != '') { |
1055 | 1055 | $xmlrpcClassName = $newClassName; |
1056 | 1056 | } else { |
1057 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1058 | - array('_', ''), $client->server) . '_client'; |
|
1057 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1058 | + array('_', ''), $client->server).'_client'; |
|
1059 | 1059 | } |
1060 | 1060 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1061 | 1061 | $xmlrpcClassName .= 'x'; |
@@ -1086,20 +1086,20 @@ discard block |
||
1086 | 1086 | if (!$buildIt) { |
1087 | 1087 | $source .= $methodWrap['docstring']; |
1088 | 1088 | } |
1089 | - $source .= $methodWrap['source'] . "\n"; |
|
1089 | + $source .= $methodWrap['source']."\n"; |
|
1090 | 1090 | } else { |
1091 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1091 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | } |
1095 | 1095 | $source .= "}\n"; |
1096 | 1096 | if ($buildIt) { |
1097 | 1097 | $allOK = 0; |
1098 | - eval($source . '$allOK=1;'); |
|
1098 | + eval($source.'$allOK=1;'); |
|
1099 | 1099 | if ($allOK) { |
1100 | 1100 | return $xmlrpcClassName; |
1101 | 1101 | } else { |
1102 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1102 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1103 | 1103 | return false; |
1104 | 1104 | } |
1105 | 1105 | } else { |
@@ -1120,10 +1120,10 @@ discard block |
||
1120 | 1120 | * |
1121 | 1121 | * @return string |
1122 | 1122 | */ |
1123 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
1123 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
1124 | 1124 | { |
1125 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
1126 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
1125 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
1126 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
1127 | 1127 | |
1128 | 1128 | // copy all client fields to the client that will be generated runtime |
1129 | 1129 | // (this provides for future expansion or subclassing of client obj) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->me['struct'] = $val; |
120 | 120 | break; |
121 | 121 | default: |
122 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
122 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | if ($typeOf !== 1) { |
147 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
147 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
148 | 148 | return 0; |
149 | 149 | } |
150 | 150 | |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | |
162 | 162 | switch ($this->mytype) { |
163 | 163 | case 1: |
164 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
164 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
165 | 165 | return 0; |
166 | 166 | case 3: |
167 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
167 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
168 | 168 | return 0; |
169 | 169 | case 2: |
170 | 170 | // we're adding a scalar value to an array here |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | return 1; |
208 | 208 | } else { |
209 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
209 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
210 | 210 | return 0; |
211 | 211 | } |
212 | 212 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | return 1; |
239 | 239 | } else { |
240 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
240 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
241 | 241 | return 0; |
242 | 242 | } |
243 | 243 | } |
@@ -279,19 +279,19 @@ discard block |
||
279 | 279 | case 1: |
280 | 280 | switch ($typ) { |
281 | 281 | case static::$xmlrpcBase64: |
282 | - $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>"; |
|
282 | + $rs .= "<${typ}>".base64_encode($val)."</${typ}>"; |
|
283 | 283 | break; |
284 | 284 | case static::$xmlrpcBoolean: |
285 | - $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>"; |
|
285 | + $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>"; |
|
286 | 286 | break; |
287 | 287 | case static::$xmlrpcString: |
288 | 288 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
289 | - $rs .= "<${typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>"; |
|
289 | + $rs .= "<${typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>"; |
|
290 | 290 | break; |
291 | 291 | case static::$xmlrpcInt: |
292 | 292 | case static::$xmlrpcI4: |
293 | 293 | case static::$xmlrpcI8: |
294 | - $rs .= "<${typ}>" . (int)$val . "</${typ}>"; |
|
294 | + $rs .= "<${typ}>".(int) $val."</${typ}>"; |
|
295 | 295 | break; |
296 | 296 | case static::$xmlrpcDouble: |
297 | 297 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | // sprintf('%F') could be most likely ok but it fails eg. on 2e-14. |
300 | 300 | // The code below tries its best at keeping max precision while avoiding exp notation, |
301 | 301 | // but there is of course no limit in the number of decimal places to be used... |
302 | - $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</${typ}>"; |
|
302 | + $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</${typ}>"; |
|
303 | 303 | break; |
304 | 304 | case static::$xmlrpcDateTime: |
305 | 305 | if (is_string($val)) { |
306 | 306 | $rs .= "<${typ}>${val}</${typ}>"; |
307 | 307 | } elseif (is_a($val, 'DateTime')) { |
308 | - $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>"; |
|
308 | + $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>"; |
|
309 | 309 | } elseif (is_int($val)) { |
310 | - $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>"; |
|
310 | + $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>"; |
|
311 | 311 | } else { |
312 | 312 | // not really a good idea here: but what shall we output anyway? left for backward compat... |
313 | 313 | $rs .= "<${typ}>${val}</${typ}>"; |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | case 3: |
330 | 330 | // struct |
331 | 331 | if ($this->_php_class) { |
332 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
332 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
333 | 333 | } else { |
334 | 334 | $rs .= "<struct>\n"; |
335 | 335 | } |
336 | 336 | $charsetEncoder = $this->getCharsetEncoder(); |
337 | 337 | /** @var Value $val2 */ |
338 | 338 | foreach ($val as $key2 => $val2) { |
339 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
339 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
340 | 340 | //$rs.=$this->serializeval($val2); |
341 | 341 | $rs .= $val2->serialize($charsetEncoding); |
342 | 342 | $rs .= "</member>\n"; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $val = reset($this->me); |
373 | 373 | $typ = key($this->me); |
374 | 374 | |
375 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
375 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function xmlrpc_debugmsg($msg) |
205 | 205 | { |
206 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
206 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public static function error_occurred($msg) |
217 | 217 | { |
218 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
218 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
235 | 235 | $out = ''; |
236 | 236 | if ($this->debug_info != '') { |
237 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
237 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
238 | 238 | } |
239 | 239 | if (static::$_xmlrpc_debuginfo != '') { |
240 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
240 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
241 | 241 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
242 | 242 | // into return payload AFTER the beginning tag |
243 | 243 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | $this->debug_info = ''; |
268 | 268 | |
269 | 269 | // Save what we received, before parsing it |
270 | - if ($this->debug > 1) { |
|
271 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
270 | + if ($this->debug>1) { |
|
271 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -280,21 +280,21 @@ discard block |
||
280 | 280 | // save full body of request into response, for more debugging usages |
281 | 281 | $r->raw_data = $rawData; |
282 | 282 | |
283 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
284 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
285 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
283 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
284 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
285 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | $payload = $this->xml_header($respCharset); |
289 | - if ($this->debug > 0) { |
|
290 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
289 | + if ($this->debug>0) { |
|
290 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // Do not create response serialization if it has already happened. Helps building json magic |
294 | 294 | if (empty($r->payload)) { |
295 | 295 | $r->serialize($respCharset); |
296 | 296 | } |
297 | - $payload = $payload . $r->payload; |
|
297 | + $payload = $payload.$r->payload; |
|
298 | 298 | |
299 | 299 | if ($returnPayload) { |
300 | 300 | return $payload; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // if we get a warning/error that has output some text before here, then we cannot |
304 | 304 | // add a new header. We cannot say we are sending xml, either... |
305 | 305 | if (!headers_sent()) { |
306 | - header('Content-Type: ' . $r->content_type); |
|
306 | + header('Content-Type: '.$r->content_type); |
|
307 | 307 | // we do not know if client actually told us an accepted charset, but if he did |
308 | 308 | // we have to tell him what we did |
309 | 309 | header("Vary: Accept-Charset"); |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
333 | 333 | // responses up to 8000 bytes |
334 | 334 | if ($phpNoSelfCompress) { |
335 | - header('Content-Length: ' . (int)strlen($payload)); |
|
335 | + header('Content-Length: '.(int) strlen($payload)); |
|
336 | 336 | } |
337 | 337 | } else { |
338 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
338 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | print $payload; |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | $numParams = count($in); |
391 | 391 | } |
392 | 392 | foreach ($sigs as $curSig) { |
393 | - if (count($curSig) == $numParams + 1) { |
|
393 | + if (count($curSig) == $numParams+1) { |
|
394 | 394 | $itsOK = 1; |
395 | - for ($n = 0; $n < $numParams; $n++) { |
|
395 | + for ($n = 0; $n<$numParams; $n++) { |
|
396 | 396 | if (is_object($in)) { |
397 | 397 | $p = $in->getParam($n); |
398 | 398 | if ($p->kindOf() == 'scalar') { |
@@ -405,10 +405,10 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | // param index is $n+1, as first member of sig is return type |
408 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
408 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
409 | 409 | $itsOK = 0; |
410 | - $pno = $n + 1; |
|
411 | - $wanted = $curSig[$n + 1]; |
|
410 | + $pno = $n+1; |
|
411 | + $wanted = $curSig[$n+1]; |
|
412 | 412 | $got = $pt; |
413 | 413 | break; |
414 | 414 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | // check if $_SERVER is populated: it might have been disabled via ini file |
436 | 436 | // (this is true even when in CLI mode) |
437 | 437 | if (count($_SERVER) == 0) { |
438 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
438 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
439 | 439 | } |
440 | 440 | |
441 | - if ($this->debug > 1) { |
|
441 | + if ($this->debug>1) { |
|
442 | 442 | if (function_exists('getallheaders')) { |
443 | 443 | $this->debugmsg(''); // empty line |
444 | 444 | foreach (getallheaders() as $name => $val) { |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
461 | 461 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
462 | 462 | $data = $degzdata; |
463 | - if ($this->debug > 1) { |
|
464 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
463 | + if ($this->debug>1) { |
|
464 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
465 | 465 | } |
466 | 466 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
467 | 467 | $data = $degzdata; |
468 | - if ($this->debug > 1) { |
|
469 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
468 | + if ($this->debug>1) { |
|
469 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
470 | 470 | } |
471 | 471 | } else { |
472 | 472 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (extension_loaded('mbstring')) { |
557 | 557 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
558 | 558 | } else { |
559 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
559 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | } |
@@ -575,16 +575,16 @@ discard block |
||
575 | 575 | |
576 | 576 | $xmlRpcParser = $this->getParser(); |
577 | 577 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST, $options); |
578 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
578 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
579 | 579 | // (BC) we return XML error as a faultCode |
580 | 580 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
581 | 581 | $r = new Response(0, |
582 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
582 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
583 | 583 | $xmlRpcParser->_xh['isf_reason']); |
584 | 584 | } elseif ($xmlRpcParser->_xh['isf']) { |
585 | 585 | $r = new Response(0, |
586 | 586 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
587 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
587 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
588 | 588 | } else { |
589 | 589 | // small layering violation in favor of speed and memory usage: |
590 | 590 | // we should allow the 'execute' method handle this, but in the |
@@ -595,20 +595,20 @@ discard block |
||
595 | 595 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
596 | 596 | ) |
597 | 597 | ) { |
598 | - if ($this->debug > 1) { |
|
599 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
598 | + if ($this->debug>1) { |
|
599 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
600 | 600 | } |
601 | 601 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
602 | 602 | } else { |
603 | 603 | // build a Request object with data parsed from xml |
604 | 604 | $req = new Request($xmlRpcParser->_xh['method']); |
605 | 605 | // now add parameters in |
606 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
606 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
607 | 607 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
608 | 608 | } |
609 | 609 | |
610 | - if ($this->debug > 1) { |
|
611 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
610 | + if ($this->debug>1) { |
|
611 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
612 | 612 | } |
613 | 613 | $r = $this->execute($req); |
614 | 614 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | return new Response( |
662 | 662 | 0, |
663 | 663 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
664 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
664 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
665 | 665 | ); |
666 | 666 | } |
667 | 667 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | |
675 | 675 | if (is_array($func)) { |
676 | 676 | if (is_object($func[0])) { |
677 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
677 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
678 | 678 | } else { |
679 | 679 | $funcName = implode('::', $func); |
680 | 680 | } |
@@ -686,17 +686,17 @@ discard block |
||
686 | 686 | |
687 | 687 | // verify that function to be invoked is in fact callable |
688 | 688 | if (!is_callable($func)) { |
689 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
689 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
690 | 690 | return new Response( |
691 | 691 | 0, |
692 | 692 | PhpXmlRpc::$xmlrpcerr['server_error'], |
693 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
693 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
694 | 694 | ); |
695 | 695 | } |
696 | 696 | |
697 | 697 | // If debug level is 3, we should catch all errors generated during |
698 | 698 | // processing of user function, and log them as part of response |
699 | - if ($this->debug > 2) { |
|
699 | + if ($this->debug>2) { |
|
700 | 700 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
701 | 701 | } |
702 | 702 | |
@@ -709,14 +709,14 @@ discard block |
||
709 | 709 | $r = call_user_func($func, $req); |
710 | 710 | } |
711 | 711 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
712 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
712 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
713 | 713 | if (is_a($r, 'PhpXmlRpc\Value')) { |
714 | 714 | $r = new Response($r); |
715 | 715 | } else { |
716 | 716 | $r = new Response( |
717 | 717 | 0, |
718 | 718 | PhpXmlRpc::$xmlrpcerr['server_error'], |
719 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
719 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
720 | 720 | ); |
721 | 721 | } |
722 | 722 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
733 | 733 | // an error response |
734 | 734 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
735 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
735 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
736 | 736 | } else { |
737 | 737 | // functions using EPI api should NOT return resp objects, |
738 | 738 | // so make sure we encode the return type correctly |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | // in the called function, we wrap it in a proper error-response |
757 | 757 | switch ($this->exception_handling) { |
758 | 758 | case 2: |
759 | - if ($this->debug > 2) { |
|
759 | + if ($this->debug>2) { |
|
760 | 760 | if (self::$_xmlrpcs_prev_ehandler) { |
761 | 761 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
762 | 762 | } else { |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
772 | 772 | } |
773 | 773 | } |
774 | - if ($this->debug > 2) { |
|
774 | + if ($this->debug>2) { |
|
775 | 775 | // note: restore the error handler we found before calling the |
776 | 776 | // user func, even if it has been changed inside the func itself |
777 | 777 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | */ |
792 | 792 | protected function debugmsg($string) |
793 | 793 | { |
794 | - $this->debug_info .= $string . "\n"; |
|
794 | + $this->debug_info .= $string."\n"; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -801,9 +801,9 @@ discard block |
||
801 | 801 | protected function xml_header($charsetEncoding = '') |
802 | 802 | { |
803 | 803 | if ($charsetEncoding != '') { |
804 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
804 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
805 | 805 | } else { |
806 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
806 | + return "<?xml version=\"1.0\"?".">\n"; |
|
807 | 807 | } |
808 | 808 | } |
809 | 809 | |
@@ -1055,12 +1055,12 @@ discard block |
||
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | $req = new Request($methName->scalarval()); |
1058 | - foreach($params as $i => $param) { |
|
1058 | + foreach ($params as $i => $param) { |
|
1059 | 1059 | if (!$req->addParam($param)) { |
1060 | 1060 | $i++; // for error message, we count params from 1 |
1061 | 1061 | return static::_xmlrpcs_multicall_error(new Response(0, |
1062 | 1062 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1063 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1063 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1132,12 +1132,12 @@ discard block |
||
1132 | 1132 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
1133 | 1133 | if (is_object($req)) { |
1134 | 1134 | $calls = $req->getParam(0); |
1135 | - foreach($calls as $call) { |
|
1135 | + foreach ($calls as $call) { |
|
1136 | 1136 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
1137 | 1137 | } |
1138 | 1138 | } else { |
1139 | 1139 | $numCalls = count($req); |
1140 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1140 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1141 | 1141 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | 4 | |
5 | -include_once __DIR__ . '/parse_args.php'; |
|
5 | +include_once __DIR__.'/parse_args.php'; |
|
6 | 6 | |
7 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
7 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
8 | 8 | |
9 | 9 | use PHPUnit\Runner\BaseTestRunner; |
10 | 10 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->client->server .= 'XXX'; |
59 | 59 | $dnsinfo = @dns_get_record($this->client->server); |
60 | 60 | if ($dnsinfo) { |
61 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
61 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
62 | 62 | } else { |
63 | 63 | $r = $this->client->send($m, 5); |
64 | 64 | // make sure there's no freaking catchall DNS in effect |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | // now test a successful connection |
75 | 75 | $server = explode(':', $this->args['HTTPSERVER']); |
76 | - if (count($server) > 1) { |
|
76 | + if (count($server)>1) { |
|
77 | 77 | $this->client->port = $server[1]; |
78 | 78 | } |
79 | 79 | $this->client->server = $server[0]; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | // now test a successful connection |
98 | 98 | $server = explode(':', $this->args['HTTPSERVER']); |
99 | - if (count($server) > 1) { |
|
99 | + if (count($server)>1) { |
|
100 | 100 | $this->client->port = $server[1]; |
101 | 101 | } |
102 | 102 | $this->client->server = $server[0]; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | // now test a successful connection |
127 | 127 | $server = explode(':', $this->args['HTTPSERVER']); |
128 | - if (count($server) > 1) { |
|
128 | + if (count($server)>1) { |
|
129 | 129 | $this->client->port = $server[1]; |
130 | 130 | } |
131 | 131 | $this->client->server = $server[0]; |