public function CallbackHandler::call in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-stdlib/src/CallbackHandler.php \Zend\Stdlib\CallbackHandler::call()
Invoke handler
Parameters
array $args Arguments to pass to callback:
Return value
mixed
1 call to CallbackHandler::call()
- CallbackHandler::__invoke in vendor/
zendframework/ zend-stdlib/ src/ CallbackHandler.php - Invoke as functor
File
- vendor/
zendframework/ zend-stdlib/ src/ CallbackHandler.php, line 78
Class
- CallbackHandler
- CallbackHandler
Namespace
Zend\StdlibCode
public function call(array $args = []) {
$callback = $this
->getCallback();
$argCount = count($args);
if (is_string($callback)) {
$result = $this
->validateStringCallbackFor54($callback);
if ($result !== true && $argCount <= 3) {
$callback = $result;
// Minor performance tweak, if the callback gets called more
// than once
$this->callback = $result;
}
}
// Minor performance tweak; use call_user_func() until > 3 arguments
// reached
switch ($argCount) {
case 0:
return $callback();
case 1:
return $callback(array_shift($args));
case 2:
$arg1 = array_shift($args);
$arg2 = array_shift($args);
return $callback($arg1, $arg2);
case 3:
$arg1 = array_shift($args);
$arg2 = array_shift($args);
$arg3 = array_shift($args);
return $callback($arg1, $arg2, $arg3);
default:
return call_user_func_array($callback, $args);
}
}