protected function handle(Request $request)
    {
        try {
            list($routeInformation, $parameters) = $this->findRoute($request);

            return (new Pipeline($this->container))
                ->through($routeInformation['middlewares'])
                ->send($request)
                ->then(function (Request $request) use ($routeInformation, $parameters) {
                    if ($routeInformation['action'] instanceof Closure) {
                        return call_user_func_array($routeInformation['action'], $parameters);
                    }

                    list($controller, $action) = $routeInformation['action'];
                    $controllerInstance = new $controller;

                    if ($controllerInstance instanceof KeeperBaseController) {
                        $controllerInstance->setContainer($this->container);
                        $controllerInstance->setRequest($request);
                    }

                    return call_user_func_array([$controllerInstance, $action], $parameters);
                });

        } catch (Throwable $exception) {
            if ($this->exceptionHandler) {
                return $this->exceptionHandler->handle($exception, $request);
            }

            return new Response((string)$exception, 500);
        }
    }
protected function handle(Request $request)
    {
        try {
            list($routeInformation, $parameters) = $this->findRoute($request);

            return (new Pipeline($this->container))
                ->through($routeInformation['middlewares'])
                ->send($request)
                ->then(function (Request $request) use ($routeInformation, $parameters) {
                    if ($routeInformation['action'] instanceof Closure) {
                        return call_user_func_array($routeInformation['action'], $parameters);
                    }

                    list($controller, $action) = $routeInformation['action'];
                    $controllerInstance = new $controller;

                    if ($controllerInstance instanceof KeeperBaseController) {
                        $controllerInstance->setContainer($this->container);
                        $controllerInstance->setRequest($request);
                    }

                    return call_user_func_array([$controllerInstance, $action], $parameters);
                });

        } catch (Throwable $exception) {
            if ($this->exceptionHandler) {
                return $this->exceptionHandler->handle($exception, $request);
            }

            return new Response((string)$exception, 500);
        }
    }
protected function handle ( Request $ request ) { try { list ( $ routeInformation , $ parameters ) = $ this -> findRoute ( $ request ) ; return ( new Pipeline ( $ this -> container ) ) -> through ( $ routeInformation [ 'middlewares' ] ) -> send ( $ request ) -> then ( function ( Request $ request ) use ( $ routeInformation , $ parameters ) { if ( $ routeInformation [ 'action' ] instanceof Closure ) { return call_user_func_array ( $ routeInformation [ 'action' ] , $ parameters ) ; } list ( $ controller , $ action ) = $ routeInformation [ 'action' ] ; $ controllerInstance = new $ controller ; if ( $ controllerInstance instanceof KeeperBaseController ) { $ controllerInstance -> setContainer ( $ this -> container ) ; $ controllerInstance -> setRequest ( $ request ) ; } return call_user_func_array ( [ $ controllerInstance , $ action ] , $ parameters ) ; } ) ; } catch ( Throwable $ exception ) { if ( $ this -> exceptionHandler ) { return $ this -> exceptionHandler -> handle ( $ exception , $ request ) ; } return new Response ( ( string ) $ exception , 500 ) ; } }
Handle Http request and return processed result

@param Request $request

@return mixed
Handle Http request and return processed result