protected function callNativeFunction($name, $args, &$returnValue)
{
// try a lib function
$name = $this->normalizeName($name);
if (isset($this->userFunctions[$name])) {
// see if we can find a user function
list($f, $prototype) = $this->userFunctions[$name];
} elseif (($f = $this->getBuiltinFunction($name)) && is_callable($f)) {
$libName = $f[1];
$prototype = isset(static::${$libName}) ? static::${$libName} : null;
} else {
return false;
}
list($sorted, $kwargs) = $this->sortArgs($prototype, $args);
if ($name !== 'if' && $name !== 'call') {
foreach ($sorted as &$val) {
$val = $this->reduce($val, true);
}
}
$returnValue = call_user_func($f, $sorted, $kwargs);
if (!isset($returnValue)) {
return false;
}
$returnValue = $this->coerceValue($returnValue);
return true;
}