adopt CI-like patterns
[plcapi.git] / src / Response.php
index cc33ebf..e634ce5 100644 (file)
@@ -11,6 +11,8 @@ use PhpXmlRpc\Helper\Charset;
  */
 class Response
 {
+    protected static $charsetEncoder;
+
     /// @todo: do these need to be public?
     /** @internal */
     public $val = 0;
@@ -26,6 +28,19 @@ class Response
     public $_cookies = array();
     public $raw_data = '';
 
+    public function getCharsetEncoder()
+    {
+        if (self::$charsetEncoder === null) {
+            self::$charsetEncoder = Charset::instance();
+        }
+        return self::$charsetEncoder;
+    }
+
+    public function setCharsetEncoder($charsetEncoder)
+    {
+        self::$charsetEncoder = $charsetEncoder;
+    }
+
     /**
      * @param Value|string|mixed $val either a Value object, a php value or the xml serialization of an xmlrpc value (a string)
      * @param integer $fCode set it to anything but 0 to create an error response. In that case, $val is discarded