7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_XmlRpc
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: ServerProxy.php 16541 2009-07-07 06:59:03Z bkarwin $
25 * The namespace decorator enables object chaining to permit
26 * calling XML-RPC namespaced functions like "foo.bar.baz()"
27 * as "$remote->foo->bar->baz()".
30 * @package Zend_XmlRpc
32 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
35 class Zend_XmlRpc_Client_ServerProxy
38 * @var Zend_XmlRpc_Client
40 private $_client = null;
45 private $_namespace = '';
49 * @var array of Zend_XmlRpc_Client_ServerProxy
51 private $_cache = array();
57 * @param string $namespace
58 * @param Zend_XmlRpc_Client $client
60 public function __construct($client, $namespace = '')
62 $this->_namespace
= $namespace;
63 $this->_client
= $client;
68 * Get the next successive namespace
71 * @return Zend_XmlRpc_Client_ServerProxy
73 public function __get($namespace)
75 $namespace = ltrim("$this->_namespace.$namespace", '.');
76 if (!isset($this->_cache
[$namespace])) {
77 $this->_cache
[$namespace] = new $this($this->_client
, $namespace);
79 return $this->_cache
[$namespace];
84 * Call a method in this namespace.
86 * @param string $methodN
90 public function __call($method, $args)
92 $method = ltrim("$this->_namespace.$method", '.');
93 return $this->_client
->call($method, $args);