foo->bar->baz()". */ class ServerProxy { /** * @var \Zend\XmlRpc\Client */ private $client = null; /** * @var string */ private $namespace = ''; /** * @var array of \Zend\XmlRpc\Client\ServerProxy */ private $cache = array(); /** * Class constructor * * @param \Zend\XmlRpc\Client $client * @param string $namespace */ public function __construct(XMLRPCClient $client, $namespace = '') { $this->client = $client; $this->namespace = $namespace; } /** * Get the next successive namespace * * @param string $namespace * @return \Zend\XmlRpc\Client\ServerProxy */ public function __get($namespace) { $namespace = ltrim("$this->namespace.$namespace", '.'); if (!isset($this->cache[$namespace])) { $this->cache[$namespace] = new $this($this->client, $namespace); } return $this->cache[$namespace]; } /** * Call a method in this namespace. * * @param string $method * @param array $args * @return mixed */ public function __call($method, $args) { $method = ltrim("{$this->namespace}.{$method}", '.'); return $this->client->call($method, $args); } }