@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | public function xml_header($charsetEncoding = '') |
| 91 | 91 | { |
| 92 | 92 | if ($charsetEncoding != '') { |
| 93 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 93 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 94 | 94 | } else { |
| 95 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 95 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -112,16 +112,16 @@ discard block |
||
| 112 | 112 | public function createPayload($charsetEncoding = '') |
| 113 | 113 | { |
| 114 | 114 | if ($charsetEncoding != '') { |
| 115 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 115 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 116 | 116 | } else { |
| 117 | 117 | $this->content_type = 'text/xml'; |
| 118 | 118 | } |
| 119 | 119 | $this->payload = $this->xml_header($charsetEncoding); |
| 120 | - $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
| 121 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 120 | + $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
| 121 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 122 | 122 | $this->payload .= "<params>\n"; |
| 123 | 123 | foreach ($this->params as $p) { |
| 124 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 124 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 125 | 125 | "</param>\n"; |
| 126 | 126 | } |
| 127 | 127 | $this->payload .= "</params>\n"; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 249 | 249 | |
| 250 | 250 | if ($data == '') { |
| 251 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 251 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 252 | 252 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 253 | 253 | } |
| 254 | 254 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | // failed processing of HTTP response headers |
| 262 | 262 | // save into response obj the full payload received, for debugging |
| 263 | 263 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
| 264 | - } catch(\Exception $e) { |
|
| 264 | + } catch (\Exception $e) { |
|
| 265 | 265 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
| 276 | 276 | $pos = strrpos($data, '</methodResponse>'); |
| 277 | 277 | if ($pos !== false) { |
| 278 | - $data = substr($data, 0, $pos + 17); |
|
| 278 | + $data = substr($data, 0, $pos+17); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // try to 'guestimate' the character encoding of the received response |
@@ -286,9 +286,9 @@ discard block |
||
| 286 | 286 | if ($start) { |
| 287 | 287 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 288 | 288 | $end = strpos($data, '-->', $start); |
| 289 | - $comments = substr($data, $start, $end - $start); |
|
| 290 | - $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
| 291 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
| 289 | + $comments = substr($data, $start, $end-$start); |
|
| 290 | + $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
| 291 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | if (extension_loaded('mbstring')) { |
| 312 | 312 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
| 313 | 313 | } else { |
| 314 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
| 314 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE, $options); |
| 333 | 333 | |
| 334 | 334 | // first error check: xml not well formed |
| 335 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
| 335 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
| 336 | 336 | |
| 337 | 337 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
| 338 | 338 | |
| 339 | 339 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
| 340 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
| 340 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
| 341 | 341 | $this->httpResponse |
| 342 | 342 | ); |
| 343 | 343 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | // second error check: xml well formed but not xml-rpc compliant |
| 349 | 349 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
| 350 | 350 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
| 351 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
| 351 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
| 352 | 352 | $this->httpResponse |
| 353 | 353 | ); |
| 354 | 354 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | '', $this->httpResponse |
| 365 | 365 | ); |
| 366 | 366 | } else { |
| 367 | - if ($this->debug > 1) { |
|
| 367 | + if ($this->debug>1) { |
|
| 368 | 368 | $this->getLogger()->debugMessage( |
| 369 | 369 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
| 370 | 370 | ); |