protected static _callable ( object $request, array $params, array $options ) : object | ||
$request | object | The instance of the `Request` class either passed into or generated by `Dispatcher::run()`. |
$params | array | The parameter array generated by routing the request. |
$options | array | Not currently implemented. |
return | object | Returns a callable object which the request will be routed to. |
protected static function _callable($request, $params, $options)
{
$params = compact('request', 'params', 'options');
return static::_filter(__FUNCTION__, $params, function ($self, $params) {
$options = array('request' => $params['request']) + $params['options'];
$controller = $params['params']['controller'];
try {
return Libraries::instance('controllers', $controller, $options);
} catch (ClassNotFoundException $e) {
throw new DispatchException("Controller `{$controller}` not found.", null, $e);
}
});
}