public function toUrl($url, $statusCode = 302)
    {
        $server = $this->getServer();

        $response = $server->getResponse(false)
            ->withHeader('Location', $url)
            ->withStatus($statusCode);

        return $response;
    }
public function toUrl($url, $statusCode = 302)
    {
        $server = $this->getServer();

        $response = $server->getResponse(false)
            ->withHeader('Location', $url)
            ->withStatus($statusCode);

        return $response;
    }
public function toUrl ( $ url , $ statusCode = 302 ) { $ server = $ this -> getServer ( ) ; $ response = $ server -> getResponse ( false ) -> withHeader ( 'Location' , $ url ) -> withStatus ( $ statusCode ) ; return $ response ; }
Generates redirection by given url.

@param string $url        The url
@param int    $statusCode Optional; by default 302. The status code

@return \Es\Http\Psr\ResponseInterface The response
Generates redirection by given url .