Source of file ServerProxy.php
Size: 1,851 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/XmlRpc/Client/ServerProxy.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\XmlRpc\Client; use Zend\XmlRpc\Client as XMLRPCClient; /** * The namespace decorator enables object chaining to permit * calling XML-RPC namespaced functions like "foo.bar.baz()" * as "$remote->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); } } |