3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\XmlRpc\Client
;
12 use Zend\XmlRpc\Client
as XMLRPCClient
;
15 * The namespace decorator enables object chaining to permit
16 * calling XML-RPC namespaced functions like "foo.bar.baz()"
17 * as "$remote->foo->bar->baz()".
22 * @var \Zend\XmlRpc\Client
24 private $client = null;
29 private $namespace = '';
33 * @var array of \Zend\XmlRpc\Client\ServerProxy
35 private $cache = array();
41 * @param \Zend\XmlRpc\Client $client
42 * @param string $namespace
44 public function __construct(XMLRPCClient
$client, $namespace = '')
46 $this->client
= $client;
47 $this->namespace = $namespace;
52 * Get the next successive namespace
54 * @param string $namespace
55 * @return \Zend\XmlRpc\Client\ServerProxy
57 public function __get($namespace)
59 $namespace = ltrim("$this->namespace.$namespace", '.');
60 if (!isset($this->cache
[$namespace])) {
61 $this->cache
[$namespace] = new $this($this->client
, $namespace);
63 return $this->cache
[$namespace];
68 * Call a method in this namespace.
70 * @param string $method
74 public function __call($method, $args)
76 $method = ltrim("{$this->namespace}.{$method}", '.');
77 return $this->client
->call($method, $args);