~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/XmlRpc/Client/ServerProxy.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Zend Framework
 
4
 *
 
5
 * LICENSE
 
6
 *
 
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.
 
14
 *
 
15
 * @category   Zend
 
16
 * @package    Zend_XmlRpc
 
17
 * @subpackage Client
 
18
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
19
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
20
 */
 
21
 
 
22
 
 
23
/**
 
24
 * The namespace decorator enables object chaining to permit
 
25
 * calling XML-RPC namespaced functions like "foo.bar.baz()"
 
26
 * as "$remote->foo->bar->baz()".
 
27
 *
 
28
 * @category   Zend
 
29
 * @package    Zend_XmlRpc
 
30
 * @subpackage Client
 
31
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
32
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
33
 */
 
34
class Zend_XmlRpc_Client_ServerProxy
 
35
{
 
36
    /**
 
37
     * @var Zend_XmlRpc_Client
 
38
     */
 
39
    private $_client = null;
 
40
 
 
41
    /**
 
42
     * @var string
 
43
     */
 
44
    private $_namespace = '';
 
45
 
 
46
 
 
47
    /**
 
48
     * @var array of Zend_XmlRpc_Client_ServerProxy
 
49
     */
 
50
    private $_cache = array();
 
51
 
 
52
 
 
53
    /**
 
54
     * Class constructor
 
55
     *
 
56
     * @param string             $namespace
 
57
     * @param Zend_XmlRpc_Client $client
 
58
     */
 
59
    public function __construct($client, $namespace = '')
 
60
    {
 
61
        $this->_namespace = $namespace;
 
62
        $this->_client    = $client;
 
63
    }
 
64
 
 
65
 
 
66
    /**
 
67
     * Get the next successive namespace
 
68
     *
 
69
     * @param string $name
 
70
     * @return Zend_XmlRpc_Client_ServerProxy
 
71
     */
 
72
    public function __get($namespace)
 
73
    {
 
74
        $namespace = ltrim("$this->_namespace.$namespace", '.');
 
75
        if (!isset($this->_cache[$namespace])) {
 
76
            $this->_cache[$namespace] = new $this($this->_client, $namespace);
 
77
        }
 
78
        return $this->_cache[$namespace];
 
79
    }
 
80
 
 
81
 
 
82
    /**
 
83
     * Call a method in this namespace.
 
84
     *
 
85
     * @param  string $methodN
 
86
     * @param  array $args
 
87
     * @return mixed
 
88
     */
 
89
    public function __call($method, $args)
 
90
    {
 
91
        $method = ltrim("$this->_namespace.$method", '.');
 
92
        return $this->_client->call($method, $args);
 
93
    }
 
94
}