public function __call($method, $args)
{
$aliasMethods = array('clone', 'empty');
if (isset(phpQuery::$extendMethods[$method])) {
array_unshift($args, $this);
return phpQuery::callbackRun(phpQuery::$extendMethods[$method], $args);
} elseif (isset(phpQuery::$pluginsMethods[$method])) {
array_unshift($args, $this);
$class = phpQuery::$pluginsMethods[$method];
$realClass = "phpQueryObjectPlugin_{$class}";
$return = call_user_func_array(array($realClass, $method), $args);
// XXX deprecate ?
return is_null($return) ? $this : $return;
} elseif (in_array($method, $aliasMethods)) {
return call_user_func_array(array($this, '_' . $method), $args);
} else {
throw new Exception("Method '{$method}' doesnt exist");
}
}