private function getControllerLogic($action)
    {
        list($class, $method) = getClassAndMethodFromString($action);
        $controllerClass = fixClassname(Router::$namespace, $class);

        //Todo: Dependency Injection
        /* @var $controller Controller */
        $controller = new $controllerClass();
        if (!$controller instanceof Controller) {
            throw new Exception("$class does not extend Controller");
        }
        $this->controllerMiddleware = $controller->getMiddlewares();
        return function ($request) use ($controller, $method) {
            //Todo: Dependency Injection
            return $controller->$method($request);
        };
    }
private function getControllerLogic($action)
    {
        list($class, $method) = getClassAndMethodFromString($action);
        $controllerClass = fixClassname(Router::$namespace, $class);

        //Todo: Dependency Injection
        /* @var $controller Controller */
        $controller = new $controllerClass();
        if (!$controller instanceof Controller) {
            throw new Exception("$class does not extend Controller");
        }
        $this->controllerMiddleware = $controller->getMiddlewares();
        return function ($request) use ($controller, $method) {
            //Todo: Dependency Injection
            return $controller->$method($request);
        };
    }
private function getControllerLogic ( $ action ) { list ( $ class , $ method ) = getClassAndMethodFromString ( $ action ) ; $ controllerClass = fixClassname ( Router :: $ namespace , $ class ) ; //Todo: Dependency Injection /* @var $controller Controller */ $ controller = new $ controllerClass ( ) ; if ( ! $ controller instanceof Controller ) { throw new Exception ( "$class does not extend Controller" ) ; } $ this -> controllerMiddleware = $ controller -> getMiddlewares ( ) ; return function ( $ request ) use ( $ controller , $ method ) { //Todo: Dependency Injection return $ controller -> $ method ( $ request ) ; } ; }
Converts controller action into a closure
@param $action
@return Closure
@throws Exception
Converts controller action into a closure