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
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Свойство Type Description
$_defaults Default settings for this session adapter.

Méthodes publiques

Méthode 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 méthode

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

check() public méthode

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

clear() public méthode

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

delete() public méthode

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.
Résultat Closure Function returning boolean `true` on successful delete, `false` otherwise.

isEnabled() public méthode

Determines if cookies are enabled.
public isEnabled ( ) : boolean
Résultat boolean True

isStarted() public méthode

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

key() public méthode

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

keyFormat() public static méthode

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
Résultat string The formatted key.

read() public méthode

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.
Résultat Closure Function returning data in the session if successful, `null` otherwise.

write() public méthode

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.
Résultat Closure Function returning boolean `true` on successful write, `false` otherwise.

Property Details

$_defaults protected_oe property

Default settings for this session adapter.
protected $_defaults