class Redirect implements ResponseSenderInterface

Redirect response.

Constants

MOVED_PERMANENTLY

Moved permanently status code.

FOUND

Found status code.

SEE_OTHER

See other status code.

TEMPORARY_REDIRECT

Temporary redirect status code.

PERMANENT_REDIRECT

Permanent redirect status code.

SUPPORTED_STATUS_CODES

Supported redirect types.

Properties

protected string $location Location.
protected int $statusCode Status code.

Methods

__construct(string $location, int $statusCode = self::FOUND)

Constructor.

setStatus(int $statusCode)

Sets the HTTP status code.

movedPermanently()

Sets the HTTP status code to 301.

found()

Sets the HTTP status code to 302.

seeOther()

Sets the HTTP status code to 303.

temporaryRedirect()

Sets the HTTP status code to 307.

permanentRedirect()

Sets the HTTP status code to 308.

int
getStatus()

Returns the HTTP status code.

send(Request $request, Response $response)

Sends the response.

Details

at line 91
__construct(string $location, int $statusCode = self::FOUND)

Constructor.

Parameters

string $location Location
int $statusCode Status code

at line 104
Redirect setStatus(int $statusCode)

Sets the HTTP status code.

Parameters

int $statusCode Status code

Return Value

Redirect

at line 121
Redirect movedPermanently()

Sets the HTTP status code to 301.

Return Value

Redirect

at line 133
Redirect found()

Sets the HTTP status code to 302.

Return Value

Redirect

at line 145
Redirect seeOther()

Sets the HTTP status code to 303.

Return Value

Redirect

at line 157
Redirect temporaryRedirect()

Sets the HTTP status code to 307.

Return Value

Redirect

at line 169
Redirect permanentRedirect()

Sets the HTTP status code to 308.

Return Value

Redirect

at line 181
int getStatus()

Returns the HTTP status code.

Return Value

int

at line 189
send(Request $request, Response $response)

Sends the response.

Parameters

Request $request Request instance
Response $response Response instance