public function dispatch($response = null)
    {
        if ($error = $this->error()) {
            throw new RouterException($this->message(), $error);
        }
        $this->response = $response;
        $request = $this->request;

        $generator = $this->middleware();

        $next = function() use ($request, $response, $generator, &$next) {
            $handler = $generator->current();
            $generator->next();
            return $handler($request, $response, $next);
        };
        return $next();
    }
public function dispatch($response = null)
    {
        if ($error = $this->error()) {
            throw new RouterException($this->message(), $error);
        }
        $this->response = $response;
        $request = $this->request;

        $generator = $this->middleware();

        $next = function() use ($request, $response, $generator, &$next) {
            $handler = $generator->current();
            $generator->next();
            return $handler($request, $response, $next);
        };
        return $next();
    }
public function dispatch ( $ response = null ) { if ( $ error = $ this -> error ( ) ) { throw new RouterException ( $ this -> message ( ) , $ error ) ; } $ this -> response = $ response ; $ request = $ this -> request ; $ generator = $ this -> middleware ( ) ; $ next = function ( ) use ( $ request , $ response , $ generator , & $ next ) { $ handler = $ generator -> current ( ) ; $ generator -> next ( ) ; return $ handler ( $ request , $ response , $ next ) ; } ; return $ next ( ) ; }
Dispatches the route.

@param  mixed $response The outgoing response.
@return mixed           The handler return value.
Dispatches the route .