PHP Class lithium\storage\session\adapter\Cookie

This adapter provides basic support for write, read and delete cookie handling, as well as allowing these three methods to be filtered as per the Lithium filtering system.
Inheritance: extends lithium\core\Object
Show file Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Property Type Description
$_defaults Default settings for this session adapter.

Public Methods

Method Description
__construct ( array $config = [] ) : void Constructor.
check ( string $key ) : Closure Checks if a value has been set in the cookie.
clear ( array $options = [] ) : boolean Clears all cookies.
delete ( string $key, array $options = [] ) : Closure Delete a value from the cookie store.
isEnabled ( ) : boolean Determines if cookies are enabled.
isStarted ( ) : boolean Obtain the status of the cookie storage.
key ( ) : string Obtain the top-level cookie key.
keyFormat ( string $name, array $config ) : string Formats the given $name argument for use in the cookie adapter.
read ( null | string $key = null, array $options = [] ) : Closure Read a value from the cookie.
write ( string $key, mixed $value = null, array $options = [] ) : Closure Write a value to the cookie store.

Method Details

__construct() public method

Takes care of setting appropriate configurations for this object.
public __construct ( array $config = [] ) : void
$config array Optional configuration parameters.
return void

check() public method

Checks if a value has been set in the cookie.
public check ( string $key ) : Closure
$key string Key of the entry to be checked.
return Closure Function returning boolean `true` if the key exists, `false` otherwise.

clear() public method

Clears all cookies.
public clear ( array $options = [] ) : boolean
$options array Options array. Not used fro this adapter method.
return boolean True on successful clear, false otherwise.

delete() public method

Delete a value from the cookie store.
public delete ( string $key, array $options = [] ) : Closure
$key string The key to be deleted from the cookie store.
$options array Options array.
return Closure Function returning boolean `true` on successful delete, `false` otherwise.

isEnabled() public method

Determines if cookies are enabled.
public isEnabled ( ) : boolean
return boolean True

isStarted() public method

Obtain the status of the cookie storage.
public isStarted ( ) : boolean
return boolean True if $_COOKIE has been initialized, false otherwise.

key() public method

Obtain the top-level cookie key.
public key ( ) : string
return string The configured cookie 'name' parameter

keyFormat() public static method

Formats the given $name argument for use in the cookie adapter.
public static keyFormat ( string $name, array $config ) : string
$name string The key to be formatted, e.g. `foo.bar.baz`.
$config array
return string The formatted key.

read() public method

Read a value from the cookie.
public read ( null | string $key = null, array $options = [] ) : Closure
$key null | string Key of the entry to be read. If $key is null, returns all cookie key/value pairs that have been set.
$options array Options array. Not used in this adapter.
return Closure Function returning data in the session if successful, `null` otherwise.

write() public method

Write a value to the cookie store.
public write ( string $key, mixed $value = null, array $options = [] ) : Closure
$key string Key of the item to be stored.
$value mixed The value to be stored.
$options array Options array.
return Closure Function returning boolean `true` on successful write, `false` otherwise.

Property Details

$_defaults protected property

Default settings for this session adapter.
protected $_defaults