PHP Class Bluz\Session\Session

Author: Anton Shevchuk
Inheritance: use trait Bluz\Common\Options
Afficher le fichier Open project: bluzphp/framework Class Usage Examples

Protected Properties

Свойство Type Description
$adapter Session save handler
$name value returned by session_name()
$namespace namespace

Méthodes publiques

Méthode Description
contains ( string $key ) : boolean Isset
cookieExists ( ) : boolean Returns true if session ID is set
delete ( string $key ) : void Unset
destroy ( ) : void Destroy/end a session
expireSessionCookie ( ) : void Expire the session cookie
get ( string $key ) : mixed Get value by key
getAdapter ( ) : SessionHandlerInterface Get SaveHandler Object
getId ( ) : string Get session ID
getName ( ) : string Get session name
getNamespace ( ) : string Get Namespace
regenerateId ( boolean $deleteOldSession = true ) : boolean Regenerate id
sessionExists ( ) : boolean Does a session started and is it currently active?
set ( string $key, mixed $value ) : void Set key/value pair
setAdapter ( SessionHandlerInterface $saveHandler ) : Session Set session save handler object
setId ( string $id ) : Session Set session ID
setName ( string $name ) : Session Attempt to set the session name
setNamespace ( string $namespace ) : Session Set Namespace
setSessionCookieLifetime ( integer $ttl ) : void Set the session cookie lifetime
start ( ) : void Start session

Méthodes protégées

Méthode Description
initAdapter ( ) : boolean Register Save Handler with ext/session
setSavePath ( string $savePath ) : Session Set session save path

Method Details

contains() public méthode

Isset
public contains ( string $key ) : boolean
$key string
Résultat boolean

cookieExists() public méthode

Returns true if session ID is set
public cookieExists ( ) : boolean
Résultat boolean

delete() public méthode

Unset
public delete ( string $key ) : void
$key string
Résultat void

destroy() public méthode

Destroy/end a session
public destroy ( ) : void
Résultat void

expireSessionCookie() public méthode

Sends a session cookie with no value, and with an expiry in the past.
public expireSessionCookie ( ) : void
Résultat void

get() public méthode

Get value by key
public get ( string $key ) : mixed
$key string
Résultat mixed

getAdapter() public méthode

Get SaveHandler Object
public getAdapter ( ) : SessionHandlerInterface
Résultat SessionHandlerInterface

getId() public méthode

Proxies to {@link session_id()}
public getId ( ) : string
Résultat string

getName() public méthode

Proxies to {@link session_name()}.
public getName ( ) : string
Résultat string

getNamespace() public méthode

Get Namespace
public getNamespace ( ) : string
Résultat string

initAdapter() protected méthode

Since ext/session is coupled to this particular session manager register the save handler with ext/session.
protected initAdapter ( ) : boolean
Résultat boolean

regenerateId() public méthode

Regenerate the session ID, using session save handler's native ID generation Can safely be called in the middle of a session.
public regenerateId ( boolean $deleteOldSession = true ) : boolean
$deleteOldSession boolean
Résultat boolean

sessionExists() public méthode

Does a session started and is it currently active?
public sessionExists ( ) : boolean
Résultat boolean

set() public méthode

Set key/value pair
public set ( string $key, mixed $value ) : void
$key string
$value mixed
Résultat void

setAdapter() public méthode

Set session save handler object
public setAdapter ( SessionHandlerInterface $saveHandler ) : Session
$saveHandler SessionHandlerInterface
Résultat Session

setId() public méthode

Can safely be called in the middle of a session.
public setId ( string $id ) : Session
$id string
Résultat Session

setName() public méthode

If the session has already been started, or if the name provided fails validation, an exception will be raised.
public setName ( string $name ) : Session
$name string
Résultat Session

setNamespace() public méthode

Set Namespace
public setNamespace ( string $namespace ) : Session
$namespace string
Résultat Session

setSavePath() protected méthode

Set session save path
protected setSavePath ( string $savePath ) : Session
$savePath string
Résultat Session

setSessionCookieLifetime() public méthode

If a session already exists, destroys it (without sending an expiration cookie), regenerates the session ID, and restarts the session.
public setSessionCookieLifetime ( integer $ttl ) : void
$ttl integer TTL in seconds
Résultat void

start() public méthode

if No session currently exists, attempt to start it. Calls {@link isValid()} once session_start() is called, and raises an exception if validation fails.
public start ( ) : void
Résultat void

Property Details

$adapter protected_oe property

Session save handler
protected $adapter

$name protected_oe property

value returned by session_name()
protected $name

$namespace protected_oe property

namespace
protected $namespace