]> granicus.if.org Git - php/commitdiff
* now using ext/overload
authorStig Bakken <ssb@php.net>
Mon, 10 Dec 2001 17:04:56 +0000 (17:04 +0000)
committerStig Bakken <ssb@php.net>
Mon, 10 Dec 2001 17:04:56 +0000 (17:04 +0000)
# how to use:
#
# $remote = new PEAR_Remote;
# $remote->package_listAll();
# $remote->user_activate("johndoe");
#
# (when using overloading, "_" is replaced with "." before doing
#  the xmlrpc call)

pear/PEAR/Remote.php

index 920c2d68aaffd72bb03c9c6b8abf9a76dfd8702a..c89aeff080d0bb8425aa6d1bfa5dd1635bd2ebca 100644 (file)
@@ -46,11 +46,22 @@ class PEAR_Remote extends PEAR
     // {{{ call(method, [args...])
 
     function call($method)
+    {
+        $args = func_get_args();
+        array_shift($args);
+        return $this->__call($method, $args);
+    }
+
+    // }}}
+
+    // {{{ __call(method, args)
+
+    function __call($method, $params)
     {
         if (!extension_loaded("xmlrpc")) {
             return $this->raiseError("xmlrpc support not loaded");
         }
-        $params = array_slice(func_get_args(), 1);
+        $method = str_replace("_", ".", $method);
         $request = xmlrpc_encode_request($method, $params);
         $server_host = $this->config_object->get("master_server");
         if (empty($server_host)) {
@@ -99,4 +110,6 @@ class PEAR_Remote extends PEAR
     // }}}
 }
 
+overload("PEAR_Remote");
+
 ?>
\ No newline at end of file