lithium\console\Dispatcher::_callable()
Determines which command to use for current request.
Parameters
-
object
$request
An instance of a
Request
object. -
array
$params
Request params that can be accessed inside the filter.
-
array
$options
Returns
classlithium\console\Command Returns the instantiated command object.
Filter
This method can be filtered.
Source
protected static function _callable($request, $params, $options) {
$params = compact('request', 'params', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$request = $params['request'];
$params = $params['params'];
$name = $params['command'];
if (!$name) {
$request->params['args'][0] = $name;
$name = 'lithium\console\command\Help';
}
$class = Libraries::locate('command', $name);
if ($class && class_exists($class)) {
return new $class(compact('request'));
}
throw new UnexpectedValueException("Command `{$name}` not found.");
});
}