class Response extends Object implements IResponse

HttpResponse class.

Properties

string $cookieDomain
string $cookiePath
string $cookieSecure
string $cookieHttpOnly
bool $warnOnBuffer

Methods

__construct()

No description

void
setCode($code)

Sets HTTP response code.

int
getCode()

Returns HTTP response code.

void
setHeader($name, $value)

Sends a HTTP header and replaces a previous one.

void
addHeader($name, $value)

Adds HTTP header.

void
setContentType($type, $charset = NULL)

Sends a Content-type HTTP header.

void
redirect($url, $code = self::S302_FOUND)

Redirects to a new URL. Note: call exit() after it.

void
setExpiration($time)

Sets the number of seconds before a page cached on a browser expires.

bool
isSent()

Checks if headers have been sent.

mixed
getHeader($header, $default = NULL)

Returns value of an HTTP header.

array
getHeaders()

Returns a list of headers to sent.

static string
date($time = NULL)

Returns HTTP valid date format.

void
__destruct()

No description

void
setCookie($name, $value, $time, $path = NULL, $domain = NULL, $secure = NULL, $httpOnly = NULL)

Sends a cookie.

void
deleteCookie($name, $path = NULL, $domain = NULL, $secure = NULL)

Deletes a cookie.

void
removeDuplicateCookies()

Removes duplicate cookies from response.

Details

at line 43
__construct()

No description

at line 64
void setCode($code)

Sets HTTP response code.

Parameters

$code

Return Value

void

Exceptions

InvalidArgumentException
InvalidStateException

at line 82
int getCode()

Returns HTTP response code.

Return Value

int

at line 95
void setHeader($name, $value)

Sends a HTTP header and replaces a previous one.

Parameters

$name
$value

Return Value

void

Exceptions

InvalidStateException

at line 116
void addHeader($name, $value)

Adds HTTP header.

Parameters

$name
$value

Return Value

void

Exceptions

InvalidStateException

at line 131
void setContentType($type, $charset = NULL)

Sends a Content-type HTTP header.

Parameters

$type
$charset

Return Value

void

Exceptions

InvalidStateException

at line 145
void redirect($url, $code = self::S302_FOUND)

Redirects to a new URL. Note: call exit() after it.

Parameters

$url
$code

Return Value

void

Exceptions

InvalidStateException

at line 162
void setExpiration($time)

Sets the number of seconds before a page cached on a browser expires.

Parameters

$time

Return Value

void

Exceptions

InvalidStateException

at line 181
bool isSent()

Checks if headers have been sent.

Return Value

bool

at line 193
mixed getHeader($header, $default = NULL)

Returns value of an HTTP header.

Parameters

$header
$default

Return Value

mixed

at line 210
array getHeaders()

Returns a list of headers to sent.

Return Value

array

(name => value)

at line 226
static string date($time = NULL)

Returns HTTP valid date format.

Parameters

$time

Return Value

string

at line 237
void __destruct()

No description

Return Value

void

at line 261
void setCookie($name, $value, $time, $path = NULL, $domain = NULL, $secure = NULL, $httpOnly = NULL)

Sends a cookie.

Parameters

$name
$value
$time
$path
$domain
$secure
$httpOnly

Return Value

void

Exceptions

InvalidStateException

at line 287
void deleteCookie($name, $path = NULL, $domain = NULL, $secure = NULL)

Deletes a cookie.

Parameters

$name
$path
$domain
$secure

Return Value

void

Exceptions

InvalidStateException

at line 298
void removeDuplicateCookies()

internal  
 

Removes duplicate cookies from response.

Return Value

void