Zend\Diactoros\Response\RedirectResponse::__construct PHP Method

__construct() public method

Produces a redirect response with a Location header and the given status (302 by default). Note: this method overwrites the location $headers value.
public __construct ( string | Psr\Http\Message\UriInterface $uri, integer $status = 302, array $headers = [] )
$uri string | Psr\Http\Message\UriInterface URI for the Location header.
$status integer Integer status code for the redirect; 302 by default.
$headers array Array of headers to use at initialization.
    public function __construct($uri, $status = 302, array $headers = [])
    {
        if (!is_string($uri) && !$uri instanceof UriInterface) {
            throw new InvalidArgumentException(sprintf('Uri provided to %s MUST be a string or Psr\\Http\\Message\\UriInterface instance; received "%s"', __CLASS__, is_object($uri) ? get_class($uri) : gettype($uri)));
        }
        $headers['location'] = [(string) $uri];
        parent::__construct('php://temp', $status, $headers);
    }
RedirectResponse