lithium\console\Dispatcher::_call()
Calls a given command with the appropriate action.
This method is responsible for calling a $callable command and returning its result.
Parameters
-
string
$callableThe callable command.
-
string
$requestThe associated
Requestobject. -
string
$paramsAdditional params that should be passed along.
Returns
mixedReturns the result of the called action, typically true or false.
Filter
This method can be filtered.
Source
protected static function _call($callable, $request, $params) {
$params = compact('callable', 'request', 'params');
return static::_filter(__FUNCTION__, $params, function($self, $params) {
if (is_callable($callable = $params['callable'])) {
$request = $params['request'];
$params = $params['params'];
if (!method_exists($callable, $params['action'])) {
array_unshift($params['args'], $request->params['action']);
$params['action'] = 'run';
}
$isHelp = (
!empty($params['help']) || !empty($params['h']) ||
!method_exists($callable, $params['action'])
);
if ($isHelp) {
$params['action'] = '_help';
}
return $callable($params['action'], $params['args']);
}
throw new UnexpectedValueException("Callable `{$callable}` is actually not callable.");
});
}