public static function to($path, $code = 302, $trigger = true)
    {
        $debuglvl = self::$debuglvl;
        self::$debuglvl = 2;

        if (headers_sent()) {
            throw new Exception('Headers already sent', $debuglvl);
        } elseif ($code < 300 || $code > 399) {
            throw new Exception('Invalid redirect HTTP status', $debuglvl);
        } elseif (empty($path)) {
            throw new Exception('Path is not defined', $debuglvl);
        } elseif (strpos($path, '/') === 0) {
            $path = Uri::root($path);
        }

        Response::status($code, $trigger);
        Response::putHeader('Location', $path);
    }
public static function to($path, $code = 302, $trigger = true)
    {
        $debuglvl = self::$debuglvl;
        self::$debuglvl = 2;

        if (headers_sent()) {
            throw new Exception('Headers already sent', $debuglvl);
        } elseif ($code < 300 || $code > 399) {
            throw new Exception('Invalid redirect HTTP status', $debuglvl);
        } elseif (empty($path)) {
            throw new Exception('Path is not defined', $debuglvl);
        } elseif (strpos($path, '/') === 0) {
            $path = Uri::root($path);
        }

        Response::status($code, $trigger);
        Response::putHeader('Location', $path);
    }
public static function to ( $ path , $ code = 302 , $ trigger = true ) { $ debuglvl = self :: $ debuglvl ; self :: $ debuglvl = 2 ; if ( headers_sent ( ) ) { throw new Exception ( 'Headers already sent' , $ debuglvl ) ; } elseif ( $ code < 300 || $ code > 399 ) { throw new Exception ( 'Invalid redirect HTTP status' , $ debuglvl ) ; } elseif ( empty ( $ path ) ) { throw new Exception ( 'Path is not defined' , $ debuglvl ) ; } elseif ( strpos ( $ path , '/' ) === 0 ) { $ path = Uri :: root ( $ path ) ; } Response :: status ( $ code , $ trigger ) ; Response :: putHeader ( 'Location' , $ path ) ; }
Redirects to a valid path within the application

@param string $path
@param int    $code
@param bool   $trigger
@throws \Inphinit\Experimental\Exception
@return void
Redirects to a valid path within the application