public function redirect($path, $status = 301)
    {
        if (!$this->asWidget) {
            /** @var ResponseInterface $response */
            $response = (new ResponseInjector)->build();
            if (!$response) {
                throw new Exception('Component `response` not configured');
            }

            $response = $response->withStatus($status);
            $response = $response->getHeaderLine('Location: '.$path);

            return $response;
        }

        return false;
    }
public function redirect($path, $status = 301)
    {
        if (!$this->asWidget) {
            /** @var ResponseInterface $response */
            $response = (new ResponseInjector)->build();
            if (!$response) {
                throw new Exception('Component `response` not configured');
            }

            $response = $response->withStatus($status);
            $response = $response->getHeaderLine('Location: '.$path);

            return $response;
        }

        return false;
    }
public function redirect ( $ path , $ status = 301 ) { if ( ! $ this -> asWidget ) { /** @var ResponseInterface $response */ $ response = ( new ResponseInjector ) -> build ( ) ; if ( ! $ response ) { throw new Exception ( 'Component `response` not configured' ) ; } $ response = $ response -> withStatus ( $ status ) ; $ response = $ response -> getHeaderLine ( 'Location: ' . $ path ) ; return $ response ; } return false ; }
Redirect user to path

@access public

@param string $path path to redirect
@param integer $status status for redirect

@return false|ResponseInterface
@throws Exception|\InvalidArgumentException
Redirect user to path