Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / XmlRpc / Client / ServerProxy.php
blobdc065daceb83913c58985a09becbadfab159970a
1 <?php
2 /**
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
8 */
10 namespace Zend\XmlRpc\Client;
12 use Zend\XmlRpc\Client as XMLRPCClient;
14 /**
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()".
19 class ServerProxy
21 /**
22 * @var \Zend\XmlRpc\Client
24 private $client = null;
26 /**
27 * @var string
29 private $namespace = '';
32 /**
33 * @var array of \Zend\XmlRpc\Client\ServerProxy
35 private $cache = array();
38 /**
39 * Class constructor
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;
51 /**
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];
67 /**
68 * Call a method in this namespace.
70 * @param string $method
71 * @param array $args
72 * @return mixed
74 public function __call($method, $args)
76 $method = ltrim("{$this->namespace}.{$method}", '.');
77 return $this->client->call($method, $args);