本文整理汇总了PHP中vB_Api::callNamed方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_Api::callNamed方法的具体用法?PHP vB_Api::callNamed怎么用?PHP vB_Api::callNamed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_Api
的用法示例。
在下文中一共展示了vB_Api::callNamed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callNamed
/**
* @see vB_Api::callNamed
* @param mixed $current
* @param string $method -- the name of the method to call
* @param array $args -- The list of args to call. This is a name => value map that will
* be matched up to the names of the API method. Order is not important. The names are
* case sensitive.
* @return mixed
*/
public function callNamed()
{
// since the parent method has different arguments,
// we need to do this to avoid strict standards notice
list($current, $method, $args) = func_get_args();
if (!is_callable(array($this, $method))) {
/* if the method does not exist then dont check anything,
just return the current value. */
return $current;
}
// Check if the result varname is present
$foundResultVarName = false;
$reflection = new ReflectionMethod($this, $method);
foreach ($reflection->getParameters() as $param) {
if ($param->getName() == $this->resultVarName) {
$foundResultVarName = true;
break;
}
}
if (!$foundResultVarName) {
// The method is not using the result varname, so it's better to ignore it and return previous result
// todo: log this error somewhere?
return $current;
}
$args[$this->resultVarName] = $current;
return parent::callNamed($method, $args);
}