X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2FClient.php;h=79948e86b7ef565ad1733dd8dd3c65fcb1f781a4;hb=20a65226a4dad0def0ed1b34ac37c0a539fb2495;hp=a13c31bbd2aa4e744282b55f45ae0bdd92653163;hpb=4a81986352f7d0759116e6172bb1c92b356430a1;p=plcapi.git diff --git a/src/Client.php b/src/Client.php index a13c31b..79948e8 100644 --- a/src/Client.php +++ b/src/Client.php @@ -2,6 +2,8 @@ namespace PhpXmlRpc; +use PhpXmlRpc\Helper\Logger; + class Client { /// @todo: do these need to be public? @@ -360,7 +362,7 @@ class Client $req = $n; } - // where msg is a Request + // where req is a Request $req->debug = $this->debug; if ($method == 'https') { @@ -551,7 +553,7 @@ class Client $payload; if ($this->debug > 1) { - $this->debugMessage("---SENDING---\n$op\n---END---"); + Logger::instance()->debugMessage("---SENDING---\n$op\n---END---"); } if ($timeout > 0) { @@ -707,9 +709,7 @@ class Client } if ($this->debug > 1) { - $this->debugMessage("---SENDING---\n$payload\n---END---"); - // let the client see this now in case http times out... - flush(); + Logger::instance()->debugMessage("---SENDING---\n$payload\n---END---"); } if (!$keepAlive || !$this->xmlrpc_curl_handle) { @@ -848,7 +848,7 @@ class Client $message .= $name . ': ' . $val . "\n"; } $message .= "---END---"; - $this->debugMessage($message); + Logger::instance()->debugMessage($message); } if (!$result) { @@ -987,7 +987,7 @@ class Client if ($this->return_type == 'xml') { return $rets; } elseif ($this->return_type == 'phpvals') { - ///@todo test this code branch... + /// @todo test this code branch... $rets = $result->value(); if (!is_array($rets)) { return false; // bad return type from system.multicall @@ -1071,21 +1071,4 @@ class Client return $response; } } - - /** - * Echoes a debug message, taking care of escaping it when not in console mode - * - * @param string $message - */ - protected function debugMessage($message) - { - if (PHP_SAPI != 'cli') { - print "
\n".htmlentities($message)."\n
"; - } - else { - print "\n$message\n"; - } - // let the client see this now in case http times out... - flush(); - } }