File indexing completed on 2024-12-22 05:37:14
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_XmlRpc 0017 * @subpackage Client 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 0024 /** 0025 * The namespace decorator enables object chaining to permit 0026 * calling XML-RPC namespaced functions like "foo.bar.baz()" 0027 * as "$remote->foo->bar->baz()". 0028 * 0029 * @category Zend 0030 * @package Zend_XmlRpc 0031 * @subpackage Client 0032 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0033 * @license http://framework.zend.com/license/new-bsd New BSD License 0034 */ 0035 class Zend_XmlRpc_Client_ServerProxy 0036 { 0037 /** 0038 * @var Zend_XmlRpc_Client 0039 */ 0040 private $_client = null; 0041 0042 /** 0043 * @var string 0044 */ 0045 private $_namespace = ''; 0046 0047 0048 /** 0049 * @var array of Zend_XmlRpc_Client_ServerProxy 0050 */ 0051 private $_cache = array(); 0052 0053 0054 /** 0055 * Class constructor 0056 * 0057 * @param string $namespace 0058 * @param Zend_XmlRpc_Client $client 0059 */ 0060 public function __construct($client, $namespace = '') 0061 { 0062 $this->_namespace = $namespace; 0063 $this->_client = $client; 0064 } 0065 0066 0067 /** 0068 * Get the next successive namespace 0069 * 0070 * @param string $name 0071 * @return Zend_XmlRpc_Client_ServerProxy 0072 */ 0073 public function __get($namespace) 0074 { 0075 $namespace = ltrim("$this->_namespace.$namespace", '.'); 0076 if (!isset($this->_cache[$namespace])) { 0077 $this->_cache[$namespace] = new $this($this->_client, $namespace); 0078 } 0079 return $this->_cache[$namespace]; 0080 } 0081 0082 0083 /** 0084 * Call a method in this namespace. 0085 * 0086 * @param string $methodN 0087 * @param array $args 0088 * @return mixed 0089 */ 0090 public function __call($method, $args) 0091 { 0092 $method = ltrim("$this->_namespace.$method", '.'); 0093 return $this->_client->call($method, $args); 0094 } 0095 }