Remember that you can't do like Chrigu and Nate said if you want to add methods from a static class (Hence you can't create any instances of it).
A workaround is to create lambda functions calling the
methods:
// Our static handler class
static class MyHandler
{
public function getPrice($item)
{
$prices = array("apple" => 4, "orange" => 5);
return $prices[$item];
}
public function buy($item, $number)
{
$price = self::getPrice($item) * $number;
do_thing_to_sell_the_item();
return $price;
}
}
// Use reflection to get method names and parameters
$mirror = new ReflectionClass("MyHandler");
foreach ($mirror->getMethods() as $method)
{
// Create new "lambda" function for each method
// Generate argument list
$args = array();
foreach ($method->getParameters() as $param)
{
$args[] = '$'.$param->getName();
}
$args = implode(',', $args);
// Generate code
$methodname = $method->getName();
$code = "return {$real_class}::{$methodname}({$args});";
// Create function, retrieve function name
$function_name = create_function($args, $code);
// Register the function
xmlrpc_server_register_method($myserver, $methodname, $function_name);
}