class Cookies implements Countable, IteratorAggregate

Cookies.

Properties

protected array $cookies Cookies.
protected Signer $signer Signer.

Methods

__construct(array $cookies = [], Signer|null $signer = null)

Constructor.

int
count()

Returns the numner of cookies.

getIterator()

Retruns an array iterator object.

add(string $name, string $value)

Adds a cookie.

addSigned(string $name, string $value)

Adds a signed cookie.

bool
has(string $name)

Returns TRUE if the cookie exists and FALSE if not.

mixed
get(string $name, mixed $default = null)

Gets a cookie value.

mixed
getSigned(string $name, mixed $default = null)

Gets a signed cookie value.

remove(string $name)

Removes a cookie.

array
all()

Returns all the cookies.

Details

at line 43
__construct(array $cookies = [], Signer|null $signer = null)

Constructor.

Parameters

array $cookies Cookies
Signer|null $signer Signer

at line 55
int count()

Returns the numner of cookies.

Return Value

int

at line 65
ArrayIterator getIterator()

Retruns an array iterator object.

Return Value

ArrayIterator

at line 76
add(string $name, string $value)

Adds a cookie.

Parameters

string $name Cookie name
string $value Cookie value

at line 87
addSigned(string $name, string $value)

Adds a signed cookie.

Parameters

string $name Cookie name
string $value Cookie value

at line 103
bool has(string $name)

Returns TRUE if the cookie exists and FALSE if not.

Parameters

string $name Cookie name

Return Value

bool

at line 115
mixed get(string $name, mixed $default = null)

Gets a cookie value.

Parameters

string $name Cookie name
mixed $default Default value

Return Value

mixed

at line 127
mixed getSigned(string $name, mixed $default = null)

Gets a signed cookie value.

Parameters

string $name Cookie name
mixed $default Default value

Return Value

mixed

at line 147
remove(string $name)

Removes a cookie.

Parameters

string $name Cookie name

at line 157
array all()

Returns all the cookies.

Return Value

array