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 93
__construct(string $location, int $statusCode = self::FOUND)

Constructor.

Parameters

string $location Location
int $statusCode Status code

at line 106
Redirect setStatus(int $statusCode)

Sets the HTTP status code.

Parameters

int $statusCode Status code

Return Value

Redirect

at line 123
Redirect movedPermanently()

Sets the HTTP status code to 301.

Return Value

Redirect

at line 135
Redirect found()

Sets the HTTP status code to 302.

Return Value

Redirect

at line 147
Redirect seeOther()

Sets the HTTP status code to 303.

Return Value

Redirect

at line 159
Redirect temporaryRedirect()

Sets the HTTP status code to 307.

Return Value

Redirect

at line 171
Redirect permanentRedirect()

Sets the HTTP status code to 308.

Return Value

Redirect

at line 183
int getStatus()

Returns the HTTP status code.

Return Value

int

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

Sends the response.

Parameters

Request $request Request instance
Response $response Response instance