protected function handleRouteCallback(Route $route, RouteCollection $matched, array $methods_matched)
    {
        // Handle the callback
        $returned = call_user_func(
            $route->getCallback(), // Instead of relying on the slower "invoke" magic
            $this->request,
            $this->response,
            $this->service,
            $this->app,
            $this, // Pass the Klein instance
            $matched,
            $methods_matched
        );

        if ($returned instanceof AbstractResponse) {
            $this->response = $returned;
        } else {
            // Otherwise, attempt to append the returned data
            try {
                $this->response->append($returned);
            } catch (LockedResponseException $e) {
                // Do nothing, since this is an automated behavior
            }
        }
    }
protected function handleRouteCallback(Route $route, RouteCollection $matched, array $methods_matched)
    {
        // Handle the callback
        $returned = call_user_func(
            $route->getCallback(), // Instead of relying on the slower "invoke" magic
            $this->request,
            $this->response,
            $this->service,
            $this->app,
            $this, // Pass the Klein instance
            $matched,
            $methods_matched
        );

        if ($returned instanceof AbstractResponse) {
            $this->response = $returned;
        } else {
            // Otherwise, attempt to append the returned data
            try {
                $this->response->append($returned);
            } catch (LockedResponseException $e) {
                // Do nothing, since this is an automated behavior
            }
        }
    }
protected function handleRouteCallback ( Route $ route , RouteCollection $ matched , array $ methods_matched ) { // Handle the callback $ returned = call_user_func ( $ route -> getCallback ( ) , // Instead of relying on the slower "invoke" magic $ this -> request , $ this -> response , $ this -> service , $ this -> app , $ this , // Pass the Klein instance $ matched , $ methods_matched ) ; if ( $ returned instanceof AbstractResponse ) { $ this -> response = $ returned ; } else { // Otherwise, attempt to append the returned data try { $ this -> response -> append ( $ returned ) ; } catch ( LockedResponseException $ e ) { // Do nothing, since this is an automated behavior } } }
Handle a route's callback

This handles common exceptions and their output
to keep the "dispatch()" method DRY

@param Route $route
@param RouteCollection $matched
@param array $methods_matched
@return void
Handle a route s callback