protected function redirect($controller = null, $action = 'index', array $parameters = []) : Response
    {
        $host = 'http://'. $_SERVER['HTTP_HOST'];

        if ($controller === null) {

            // Apparently we want to redirect to homepage, so the host will be sufficient
            if ($action === 'index') {
                return $this->redirectUrl($host);
            }
            
            $controller = $this->getControllerName();
        }

        if ($action === 'index') {
            $action = '';
        }else{
            $action = '/' . $action;
        }

        return $this->redirectUrl(sprintf('%s/%s%s', $host, lcfirst($controller), $action), $parameters);
    }
protected function redirect($controller = null, $action = 'index', array $parameters = []) : Response
    {
        $host = 'http://'. $_SERVER['HTTP_HOST'];

        if ($controller === null) {

            // Apparently we want to redirect to homepage, so the host will be sufficient
            if ($action === 'index') {
                return $this->redirectUrl($host);
            }
            
            $controller = $this->getControllerName();
        }

        if ($action === 'index') {
            $action = '';
        }else{
            $action = '/' . $action;
        }

        return $this->redirectUrl(sprintf('%s/%s%s', $host, lcfirst($controller), $action), $parameters);
    }
protected function redirect ( $ controller = null , $ action = 'index' , array $ parameters = [ ] ) : Response { $ host = 'http://' . $ _SERVER [ 'HTTP_HOST' ] ; if ( $ controller === null ) { // Apparently we want to redirect to homepage, so the host will be sufficient if ( $ action === 'index' ) { return $ this -> redirectUrl ( $ host ) ; } $ controller = $ this -> getControllerName ( ) ; } if ( $ action === 'index' ) { $ action = '' ; } else { $ action = '/' . $ action ; } return $ this -> redirectUrl ( sprintf ( '%s/%s%s' , $ host , lcfirst ( $ controller ) , $ action ) , $ parameters ) ; }
Redirect to a controller

@param string $controller
@param string $action
@param string[] $parameters

@return Response
Redirect to a controller