protected function dispatchRequest(\Slim\Http\Request $request, \Slim\Http\Response $response)
    {
        try {
            $this->applyHook('slim.before');
            ob_start();
            $this->applyHook('slim.before.router');
            $dispatched = false;
            $matchedRoutes = $this['router']->getMatchedRoutes($request->getMethod(), $request->getPathInfo(), false);
            foreach ($matchedRoutes as $route) {
                try {
                    $this->applyHook('slim.before.dispatch');
                    $dispatched = $route->dispatch();
                    $this->applyHook('slim.after.dispatch');
                    if ($dispatched) {
                        break;
                    }
                } catch (\Slim\Exception\Pass $e) {
                    continue;
                }
            }
            if (!$dispatched) {
                $this->notFound();
            }
            $this->applyHook('slim.after.router');
        } catch (\Slim\Exception\Stop $e) {}
        $response->write(ob_get_clean());
        $this->applyHook('slim.after');
    }
protected function dispatchRequest(\Slim\Http\Request $request, \Slim\Http\Response $response)
    {
        try {
            $this->applyHook('slim.before');
            ob_start();
            $this->applyHook('slim.before.router');
            $dispatched = false;
            $matchedRoutes = $this['router']->getMatchedRoutes($request->getMethod(), $request->getPathInfo(), false);
            foreach ($matchedRoutes as $route) {
                try {
                    $this->applyHook('slim.before.dispatch');
                    $dispatched = $route->dispatch();
                    $this->applyHook('slim.after.dispatch');
                    if ($dispatched) {
                        break;
                    }
                } catch (\Slim\Exception\Pass $e) {
                    continue;
                }
            }
            if (!$dispatched) {
                $this->notFound();
            }
            $this->applyHook('slim.after.router');
        } catch (\Slim\Exception\Stop $e) {}
        $response->write(ob_get_clean());
        $this->applyHook('slim.after');
    }
protected function dispatchRequest ( \ Slim \ Http \ Request $ request , \ Slim \ Http \ Response $ response ) { try { $ this -> applyHook ( 'slim.before' ) ; ob_start ( ) ; $ this -> applyHook ( 'slim.before.router' ) ; $ dispatched = false ; $ matchedRoutes = $ this [ 'router' ] -> getMatchedRoutes ( $ request -> getMethod ( ) , $ request -> getPathInfo ( ) , false ) ; foreach ( $ matchedRoutes as $ route ) { try { $ this -> applyHook ( 'slim.before.dispatch' ) ; $ dispatched = $ route -> dispatch ( ) ; $ this -> applyHook ( 'slim.after.dispatch' ) ; if ( $ dispatched ) { break ; } } catch ( \ Slim \ Exception \ Pass $ e ) { continue ; } } if ( ! $ dispatched ) { $ this -> notFound ( ) ; } $ this -> applyHook ( 'slim.after.router' ) ; } catch ( \ Slim \ Exception \ Stop $ e ) { } $ response -> write ( ob_get_clean ( ) ) ; $ this -> applyHook ( 'slim.after' ) ; }
Dispatch request and build response

This method will route the provided Request object against all available
application routes. The provided response will reflect the status, header, and body
set by the invoked matching route.

The provided Request and Response objects are updated by reference. There is no
value returned by this method.

@param  \Slim\Http\Request  The request instance
@param  \Slim\Http\Response The response instance
Dispatch request and build response