本文整理匯總了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);
}