class Cookie

Manages cookies used by this application. The $_COOKIE superglobal variable is an associative array.

Methods

static void
delete(string $name)

Deletes a cookie from the $_COOKIE superglobal variable.

static string|int
get(string $name)

The name of the cookie we want to work with that is found in the $_COOKIE superglobal.

static bool
exists(string $name)

Checks if a particular cookie exists in the $_COOKIE superglobal variable.

static bool
set(string $name, string $value, int $expiry)

Sets a cookie to the $_COOKIE superglobal variable. Information that it needs are its name, a value, and the amount of time we want this cookie to exist.

Details

at line 16
static void delete(string $name)

Deletes a cookie from the $_COOKIE superglobal variable.

Parameters

string $name

The name of the cookie we want to remove. Also known as the constant REMEMBER_ME_COOKIE_NAME.

Return Value

void

at line 29
static string|int get(string $name)

The name of the cookie we want to work with that is found in the $_COOKIE superglobal.

Parameters

string $name

The cookie identification string we want to retrieve from the $_COOKIE superglobal. Also known as the constant REMEMBER_ME_COOKIE_NAME.

Return Value

string|int

The name of the cookie specified in the $name parameter.

at line 42
static bool exists(string $name)

Checks if a particular cookie exists in the $_COOKIE superglobal variable.

Parameters

string $name

The cookie identification string we want to check if it exists in the $_COOKIE superglobal variable. Also known as the constant REMEMBER_ME_COOKIE_NAME.

Return Value

bool

True if the cookie exists. Otherwise false.

at line 58
static bool set(string $name, string $value, int $expiry)

Sets a cookie to the $_COOKIE superglobal variable. Information that it needs are its name, a value, and the amount of time we want this cookie to exist.

Parameters

string $name

The value for REMEMBER_ME_COOKIE_NAME constant.

string $value

The value of the cookie unique to this session.

int $expiry

The amount of time we want this cookie to exist before it expires.

Return Value

bool

True if the cookie is successfully set. Otherwise it returns false.