public function redirect($uri, int $code = 302): ResponseInterface
    {
        if (!is_string($uri) && !$uri instanceof UriInterface) {
            throw new ResponseException("Redirect allowed only for string or UriInterface uris");
        }

        return $this->responseFactory->createResponse($code)->withHeader("Location", (string)$uri);
    }
public function redirect($uri, int $code = 302): ResponseInterface
    {
        if (!is_string($uri) && !$uri instanceof UriInterface) {
            throw new ResponseException("Redirect allowed only for string or UriInterface uris");
        }

        return $this->responseFactory->createResponse($code)->withHeader("Location", (string)$uri);
    }
public function redirect ( $ uri , int $ code = 302 ) : ResponseInterface { if ( ! is_string ( $ uri ) && ! $ uri instanceof UriInterface ) { throw new ResponseException ( "Redirect allowed only for string or UriInterface uris" ) ; } return $ this -> responseFactory -> createResponse ( $ code ) -> withHeader ( "Location" , ( string ) $ uri ) ; }
Mount redirect headers into response

@param UriInterface|string $uri
@param int                 $code
@return ResponseInterface

@throws ResponseException
Mount redirect headers into response