Fix ArrayIterator interface implementation; remove usage of arraysize(), structsize...
[plcapi.git] / src / Helper / Http.php
index 2fc7b80..2faf583 100644 (file)
@@ -7,9 +7,8 @@ use PhpXmlRpc\PhpXmlRpc;
 class Http
 {
     /**
-     * Decode a string that is encoded w/ "chunked" transfer encoding
-     * as defined in rfc2068 par. 19.4.6
-     * code shamelessly stolen from nusoap library by Dietrich Ayala.
+     * Decode a string that is encoded with "chunked" transfer encoding as defined in rfc2068 par. 19.4.6
+     * Code shamelessly stolen from nusoap library by Dietrich Ayala.
      *
      * @param string $buffer the string to be decoded
      *
@@ -198,7 +197,7 @@ class Http
             foreach ($httpResponse['cookies'] as $header => $value) {
                 $msg .= "COOKIE: $header={$value['value']}\n";
             }
-            $this->debugMessage($msg);
+            Logger::instance()->debugMessage($msg);
         }
 
         // if CURL was used for the call, http headers have been processed,
@@ -222,12 +221,12 @@ class Http
                         if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
                             $data = $degzdata;
                             if ($debug) {
-                                $this->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
+                                Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
                             }
                         } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
                             $data = $degzdata;
                             if ($debug) {
-                                $this->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
+                                Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
                             }
                         } else {
                             error_log('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
@@ -243,18 +242,4 @@ class Http
 
         return $httpResponse;
     }
-
-    /**
-     * 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 "<PRE>\n".htmlentities($message)."\n</PRE>";
-        } else {
-            print "\n$message\n";
-        }
-    }
 }