lithium\action\Dispatcher::_call PHP Method

_call() protected static method

Invokes the callable object returned by _callable(), and returns the results, usually a Response object instance.
See also: lithium\action
protected static _call ( object $callable, object $request, array $params ) : mixed
$callable object Typically a closure or instance of `lithium\action\Controller`.
$request object An instance of `lithium\action\Request`.
$params array An array of parameters to pass to `$callable`, along with `$request`.
return mixed Returns the return value of `$callable`, usually an instance of `lithium\action\Response`.
    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'])) {
                return $callable($params['request'], $params['params']);
            }
            throw new DispatchException('Result not callable.');
        });
    }

Usage Example

Beispiel #1
0
 protected static function _call($callable, $request, $params)
 {
     if (is_callable($callable->params['controller'])) {
         return parent::_call($callable->params['controller'], $request, $params);
     }
     static::$dispatched[] = $callable;
 }