PHP Class lithium\storage\session\adapter\Php

This adapter provides basic support for write, read and delete session 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 ini settings for this session adapter. Will disabl cookie lifetime, set cookies to HTTP only and the cache_limiter to 'nocache'.

Méthodes publiques

Méthode Description
__construct ( array $config = [] ) : void Constructor. Takes care of setting appropriate configurations for this object. Also sets session ini settings.
check ( string $key, array $options = [] ) : Closure Checks if a value has been set in the session.
clear ( array $options = [] ) : Closure Clears all keys from the session.
delete ( string $key, array $options = [] ) : Closure Delete value from the session
enabled ( ) : boolean Determines if PHP sessions are enabled.
isStarted ( ) : boolean Obtain the status of the session.
key ( string $key = null ) : mixed Sets or obtains the session ID.
overwrite ( array &$old, array $new ) : boolean Overwrites session keys and values.
read ( null | string $key = null, array $options = [] ) : Closure Read a value from the session.
write ( string $key, mixed $value, array $options = [] ) : Closure Write a value to the session.

Méthodes protégées

Méthode Description
_init ( ) Initialization of the session.
_start ( ) : boolean Starts the session.

Method Details

__construct() public méthode

Constructor. Takes care of setting appropriate configurations for this object. Also sets session ini settings.
See also: lithium\storage\session\adapter\Php::$_defaults
public __construct ( array $config = [] ) : void
$config array Configuration options matching the pattern `'session.*'` are interpreted as session ini settings. Please consult the PHP documentation for further information. A few ini settings are set by default here and will overwrite those from your php.ini. To disable sending a cache limiter set `'session.cache_limiter'` to `false`.
Résultat void

_init() protected méthode

Initialization of the session.
protected _init ( )

_start() protected méthode

Starts the session.
protected _start ( ) : boolean
Résultat boolean `true` if session successfully started (or has already been started), `false` otherwise.

check() public méthode

Checks if a value has been set in the session.
public check ( string $key, array $options = [] ) : Closure
$key string Key of the entry to be checked.
$options array Options array. Not used for this adapter method.
Résultat Closure Function returning boolean `true` if the key exists, `false` otherwise.

clear() public méthode

Clears all keys from the session.
public clear ( array $options = [] ) : Closure
$options array Options array. Not used for this adapter method.
Résultat Closure Function returning boolean `true` on successful clear, `false` otherwise.

delete() public méthode

Delete value from the session
public delete ( string $key, array $options = [] ) : Closure
$key string The key to be deleted.
$options array Options array. Not used for this adapter method.
Résultat Closure Function returning boolean `true` if the key no longer exists in the session, `false` otherwise

enabled() public static méthode

Determines if PHP sessions are enabled.
public static enabled ( ) : boolean
Résultat boolean Returns `true` if enabled (PHP session functionality can be disabled completely), `false` otherwise.

isStarted() public méthode

Obtain the status of the session.
public isStarted ( ) : boolean
Résultat boolean True if a session is currently started, False otherwise. If PHP 5.4 then we know, if PHP 5.3 then we cannot tell for sure if a session has been closed.

key() public méthode

Sets or obtains the session ID.
public key ( string $key = null ) : mixed
$key string Optional. If specified, sets the session ID to the value of `$key`.
Résultat mixed Session ID, or `null` if the session has not been started.

overwrite() public méthode

Overwrites session keys and values.
public overwrite ( array &$old, array $new ) : boolean
$old array Reference to the array that needs to be overwritten. Will usually be `$_SESSION`.
$new array The data that should overwrite the keys/values in `$old`.
Résultat boolean Always `true`.

read() public méthode

Read a value from the session.
public read ( null | string $key = null, array $options = [] ) : Closure
$key null | string Key of the entry to be read. If no key is passed, all current session data is returned.
$options array Options array. Not used for this adapter method.
Résultat Closure Function returning data in the session if successful, `false` otherwise.

write() public méthode

Write a value to the session.
public write ( string $key, mixed $value, array $options = [] ) : Closure
$key string Key of the item to be stored.
$value mixed The value to be stored.
$options array Options array. Not used for this adapter method.
Résultat Closure Function returning boolean `true` on successful write, `false` otherwise.

Property Details

$_defaults protected_oe property

Default ini settings for this session adapter. Will disabl cookie lifetime, set cookies to HTTP only and the cache_limiter to 'nocache'.
protected $_defaults