@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | return true; |
| 86 | 86 | } else { |
| 87 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value'); |
|
| 87 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value'); |
|
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | $this->logDeprecationUnlessCalledBy('serialize'); |
| 135 | 135 | |
| 136 | 136 | if ($charsetEncoding != '') { |
| 137 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 137 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 138 | 138 | } else { |
| 139 | 139 | $this->content_type = 'text/xml'; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $result = $this->xml_header($charsetEncoding); |
| 143 | - $result .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
| 144 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 143 | + $result .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
| 144 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 145 | 145 | $result .= "<params>\n"; |
| 146 | 146 | foreach ($this->params as $p) { |
| 147 | - $result .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 147 | + $result .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 148 | 148 | "</param>\n"; |
| 149 | 149 | } |
| 150 | 150 | $result .= "</params>\n"; |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | $this->logDeprecationUnlessCalledBy('createPayload'); |
| 165 | 165 | |
| 166 | 166 | if ($charsetEncoding != '') { |
| 167 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 167 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 168 | 168 | } else { |
| 169 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 169 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS) |
| 230 | 230 | { |
| 231 | - if ($this->debug > 0) { |
|
| 231 | + if ($this->debug>0) { |
|
| 232 | 232 | $this->getLogger()->debug("---GOT---\n$data\n---END---"); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 236 | 236 | |
| 237 | 237 | if ($data == '') { |
| 238 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 238 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 239 | 239 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | if (substr($data, 0, 4) == 'HTTP') { |
| 244 | 244 | $httpParser = new Http(); |
| 245 | 245 | try { |
| 246 | - $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0); |
|
| 246 | + $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0); |
|
| 247 | 247 | } catch (HttpException $e) { |
| 248 | 248 | // failed processing of HTTP response headers |
| 249 | 249 | // save into response obj the full payload received, for debugging |
| 250 | 250 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
| 251 | - } catch(\Exception $e) { |
|
| 251 | + } catch (\Exception $e) { |
|
| 252 | 252 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
| 253 | 253 | } |
| 254 | 254 | } else { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | // idea from Luca Mariano, originally in PEARified version of the lib |
| 265 | 265 | $pos = strrpos($data, '</methodResponse>'); |
| 266 | 266 | if ($pos !== false) { |
| 267 | - $data = substr($data, 0, $pos + 17); |
|
| 267 | + $data = substr($data, 0, $pos+17); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // try to 'guestimate' the character encoding of the received response |
@@ -273,21 +273,21 @@ discard block |
||
| 273 | 273 | $data |
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | - if ($this->debug >= 0) { |
|
| 276 | + if ($this->debug>=0) { |
|
| 277 | 277 | $this->httpResponse = $httpResponse; |
| 278 | 278 | } else { |
| 279 | 279 | $httpResponse = null; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if ($this->debug > 0) { |
|
| 282 | + if ($this->debug>0) { |
|
| 283 | 283 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 284 | 284 | if ($start) { |
| 285 | 285 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 286 | 286 | /// @todo what if there is no end tag? |
| 287 | 287 | $end = strpos($data, '-->', $start); |
| 288 | - $comments = substr($data, $start, $end - $start); |
|
| 289 | - $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t" . |
|
| 290 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding)); |
|
| 288 | + $comments = substr($data, $start, $end-$start); |
|
| 289 | + $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t". |
|
| 290 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding)); |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if ($respEncoding == 'ISO-8859-1') { |
| 310 | 310 | $data = utf8_encode($data); |
| 311 | 311 | } else { |
| 312 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding); |
|
| 312 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | } |
@@ -339,16 +339,16 @@ discard block |
||
| 339 | 339 | // there could be proxies meddling with the request, or network data corruption... |
| 340 | 340 | |
| 341 | 341 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
| 342 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 342 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 343 | 343 | |
| 344 | - if ($this->debug > 0) { |
|
| 344 | + if ($this->debug>0) { |
|
| 345 | 345 | $this->getLogger()->debug($_xh['isf_reason']); |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | // second error check: xml well-formed but not xml-rpc compliant |
| 349 | 349 | elseif ($_xh['isf'] == 2) { |
| 350 | 350 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
| 351 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 351 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 352 | 352 | |
| 353 | 353 | /// @todo echo something for the user? check if it was already done by the parser... |
| 354 | 354 | //if ($this->debug > 0) { |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | // third error check: parsing of the response has somehow gone boink. |
| 359 | 359 | /// @todo shall we omit this check, since we trust the parsing code? |
| 360 | - elseif ($_xh['isf'] > 3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value']))) { |
|
| 360 | + elseif ($_xh['isf']>3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value']))) { |
|
| 361 | 361 | // something odd has happened and it's time to generate a client side error indicating something odd went on |
| 362 | 362 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'], |
| 363 | 363 | '', $httpResponse |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | /// @todo echo something for the user? |
| 367 | 367 | } else { |
| 368 | - if ($this->debug > 1) { |
|
| 368 | + if ($this->debug>1) { |
|
| 369 | 369 | $this->getLogger()->debug( |
| 370 | 370 | "---PARSED---\n".var_export($_xh['value'], true)."\n---END---" |
| 371 | 371 | ); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | if ($errNo == 0) { |
| 390 | 390 | // FAULT returned, errno needs to reflect that |
| 391 | 391 | /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr |
| 392 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 392 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 393 | 393 | /// @todo in Encoder::decodeXML, we use PhpXmlRpc::$xmlrpcerr['invalid_return'] for this case (see |
| 394 | 394 | /// also the todo 17 lines above) |
| 395 | 395 | $errNo = -1; |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | case '_php_class': |
| 438 | 438 | case 'payload': |
| 439 | 439 | case 'content_type': |
| 440 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
| 440 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
| 441 | 441 | return $this->$name; |
| 442 | 442 | case 'httpResponse': |
| 443 | 443 | // manually implement the 'protected property' behaviour |
@@ -449,16 +449,16 @@ discard block |
||
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | if ($canAccess) { |
| 452 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
| 452 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
| 453 | 453 | return $this->httpResponse; |
| 454 | 454 | } else { |
| 455 | - trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR); |
|
| 455 | + trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR); |
|
| 456 | 456 | } |
| 457 | 457 | break; |
| 458 | 458 | default: |
| 459 | 459 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 460 | 460 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 461 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 461 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 462 | 462 | $result = null; |
| 463 | 463 | return $result; |
| 464 | 464 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | case 'debug': |
| 473 | 473 | case 'payload': |
| 474 | 474 | case 'content_type': |
| 475 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
| 475 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
| 476 | 476 | $this->$name = $value; |
| 477 | 477 | break; |
| 478 | 478 | case 'httpResponse': |
@@ -485,16 +485,16 @@ discard block |
||
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | if ($canAccess) { |
| 488 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
| 488 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
| 489 | 489 | $this->httpResponse = $value; |
| 490 | 490 | } else { |
| 491 | - trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR); |
|
| 491 | + trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR); |
|
| 492 | 492 | } |
| 493 | 493 | break; |
| 494 | 494 | default: |
| 495 | 495 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 496 | 496 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 497 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 497 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | case 'debug': |
| 507 | 507 | case 'payload': |
| 508 | 508 | case 'content_type': |
| 509 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
| 509 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
| 510 | 510 | return isset($this->$name); |
| 511 | 511 | case 'httpResponse': |
| 512 | 512 | // manually implement the 'protected property' behaviour |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | if ($canAccess) { |
| 521 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
| 521 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
| 522 | 522 | return isset($this->httpResponse); |
| 523 | 523 | } |
| 524 | 524 | // break through voluntarily |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | case 'debug': |
| 536 | 536 | case 'payload': |
| 537 | 537 | case 'content_type': |
| 538 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
| 538 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
| 539 | 539 | unset($this->$name); |
| 540 | 540 | break; |
| 541 | 541 | case 'httpResponse': |
@@ -548,16 +548,16 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | if ($canAccess) { |
| 551 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
| 551 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
| 552 | 552 | unset($this->httpResponse); |
| 553 | 553 | } else { |
| 554 | - trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR); |
|
| 554 | + trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR); |
|
| 555 | 555 | } |
| 556 | 556 | break; |
| 557 | 557 | default: |
| 558 | 558 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 559 | 559 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 560 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 560 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | } |