ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Instance.php
Go to the documentation of this file.
1<?php
2
3/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
4
5// LICENSE AGREEMENT. If folded, press za here to unfold and read license {{{
6
40// }}}
41
42// dependencies {{{
43require_once 'XML/RPC2/Exception.php';
44require_once 'XML/RPC2/Server/Method.php';
45require_once 'XML/RPC2/Server/CallHandler.php';
46// }}}
47
89{
90
91 // {{{ properties
92
98 private $_instance;
99
100 // }}}
101 // {{{ constructor
102
113 public function __construct($instance, $defaultPrefix)
114 {
115 $this->_instance = $instance;
116 $reflection = new ReflectionClass(get_class($instance));
117 foreach ($reflection->getMethods() as $method) {
118 if (!$method->isStatic() && $method->isPublic() && !$method->isConstructor())
119 {
120 $candidate = new XML_RPC2_Server_Method($method, $defaultPrefix);
121 if (!$candidate->isHidden()) $this->addMethod($candidate);
122 }
123 }
124 }
125
126 // }}}
127 // {{{ __call()
128
136 public function __call($methodName, $parameters)
137 {
138 if (!array_key_exists($methodName, $this->getMethods())) {
139 throw new XML_RPC2_UnknownMethodException("Method $methodName is not exported by this server");
140 }
141 return call_user_func_array(array($this->_instance, $this->getMethod($methodName)->getInternalMethod()), $parameters);
142 }
143
144 // }}}
145
146}
147
148?>
addMethod(XML_RPC2_Server_Method $method)
method appender
getMethods()
methods getter
Definition: CallHandler.php:90
getMethod($name)
method getter
__call($methodName, $parameters)
__call catchall.
Definition: Instance.php:136
__construct($instance, $defaultPrefix)
XML_RPC2_Server_Callhandler_Class Constructor.
Definition: Instance.php:113