*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / XmlRpc / Client / ServerProxy.php
blobbdea1f8c45b03ff47dc8767d68881d69013e82b6
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_XmlRpc
17 * @subpackage Client
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: ServerProxy.php 16541 2009-07-07 06:59:03Z bkarwin $
24 /**
25 * The namespace decorator enables object chaining to permit
26 * calling XML-RPC namespaced functions like "foo.bar.baz()"
27 * as "$remote->foo->bar->baz()".
29 * @category Zend
30 * @package Zend_XmlRpc
31 * @subpackage Client
32 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
35 class Zend_XmlRpc_Client_ServerProxy
37 /**
38 * @var Zend_XmlRpc_Client
40 private $_client = null;
42 /**
43 * @var string
45 private $_namespace = '';
48 /**
49 * @var array of Zend_XmlRpc_Client_ServerProxy
51 private $_cache = array();
54 /**
55 * Class constructor
57 * @param string $namespace
58 * @param Zend_XmlRpc_Client $client
60 public function __construct($client, $namespace = '')
62 $this->_namespace = $namespace;
63 $this->_client = $client;
67 /**
68 * Get the next successive namespace
70 * @param string $name
71 * @return Zend_XmlRpc_Client_ServerProxy
73 public function __get($namespace)
75 $namespace = ltrim("$this->_namespace.$namespace", '.');
76 if (!isset($this->_cache[$namespace])) {
77 $this->_cache[$namespace] = new $this($this->_client, $namespace);
79 return $this->_cache[$namespace];
83 /**
84 * Call a method in this namespace.
86 * @param string $methodN
87 * @param array $args
88 * @return mixed
90 public function __call($method, $args)
92 $method = ltrim("$this->_namespace.$method", '.');
93 return $this->_client->call($method, $args);