private function callClassController($controller, $action)
    {
        if (!class_exists($controller)) {
            throw new AppException(sprintf('Invalid class name or class "%s" does not exists', $controller));
        }

        $instance = new $controller($this);

        if ($res = $this->callMethod($instance, 'before')) {
            return $res;
        }

        if (false === $response = $this->callMethod($instance, $action)) {
            throw new AppException(sprintf('Unable to call action "%s" on controller "%s"', $action, $controller));
        }

        if ($res = $this->callMethod($instance, 'after')) {
            return $res;
        }

        return $response;
    }
private function callClassController($controller, $action)
    {
        if (!class_exists($controller)) {
            throw new AppException(sprintf('Invalid class name or class "%s" does not exists', $controller));
        }

        $instance = new $controller($this);

        if ($res = $this->callMethod($instance, 'before')) {
            return $res;
        }

        if (false === $response = $this->callMethod($instance, $action)) {
            throw new AppException(sprintf('Unable to call action "%s" on controller "%s"', $action, $controller));
        }

        if ($res = $this->callMethod($instance, 'after')) {
            return $res;
        }

        return $response;
    }
private function callClassController ( $ controller , $ action ) { if ( ! class_exists ( $ controller ) ) { throw new AppException ( sprintf ( 'Invalid class name or class "%s" does not exists' , $ controller ) ) ; } $ instance = new $ controller ( $ this ) ; if ( $ res = $ this -> callMethod ( $ instance , 'before' ) ) { return $ res ; } if ( false === $ response = $ this -> callMethod ( $ instance , $ action ) ) { throw new AppException ( sprintf ( 'Unable to call action "%s" on controller "%s"' , $ action , $ controller ) ) ; } if ( $ res = $ this -> callMethod ( $ instance , 'after' ) ) { return $ res ; } return $ response ; }
Calls class method as controller

@param string $controller
@param string $action

@return string|ResponseInterface
@throws AppException
Calls class method as controller