NativeStorage
Implements StorageInterfaceBase class providing a session store
| since |
2.0.0 |
|---|---|
| package |
Joomla Framework |
Methods
__construct
Constructor
__construct(\SessionHandlerInterface handler = null, mixed||string|int options = []) :
| since |
1.0 |
|---|
Arguments
- handler
SessionHandlerInterface|nullSession save handler- options
array<string|int, mixed>Session options
Response
mixed
abort
Aborts the current session
abort() :
| see | session_abort() |
|---|---|
| since |
2.0.0 |
Response
bool
all
Retrieves all variables from the session store
all() : mixed||string|int
| since |
2.0.0 |
|---|
Response
array<string|int, mixed>
clear
Clears all variables from the session store
clear() :
| since |
2.0.0 |
|---|
Response
void
close
Writes session data and ends session
close() :
| see | session_write_close() |
|---|---|
| since |
2.0.0 |
Response
void
gc
Perform session data garbage collection
gc() : int|bool
| see | session_gc() |
|---|---|
| since |
2.0.0 |
Response
int|boolNumber of deleted sessions on success or boolean false on failure or if the function is unsupported
get
Get data from the session store
get( name, default) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of a variable- default
mixedDefault value of a variable if not set
Response
mixedValue of a variable
getHandler
Gets the save handler instance
getHandler() : \SessionHandlerInterface|null
| since |
2.0.0 |
|---|
Response
SessionHandlerInterface|null
getId
Get the session ID
getId() :
| since |
2.0.0 |
|---|
Response
stringThe session ID
getName
Get the session name
getName() :
| since |
2.0.0 |
|---|
Response
stringThe session name
has
Check whether data exists in the session store
has( name) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of variable
Response
bool
isActive
Check if the session is active
isActive() :
| since |
2.0.0 |
|---|
Response
bool
isStarted
Check if the session is started
isStarted() :
| since |
2.0.0 |
|---|
Response
bool
regenerate
Regenerates the session ID that represents this storage.
regenerate( destroy = false) :
This method must invoke session_regenerate_id($destroy) unless this interface is used for a storage object designed for unit or functional testing where a real PHP session would interfere with testing.
| see | session_regenerate_id() |
|---|---|
| since |
2.0.0 |
Arguments
- destroy
boolDestroy session when regenerating?
Response
boolTrue on success
remove
Unset a variable from the session store
remove( name) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of variable
Response
mixedThe value from session or NULL if not set
set
Set data into the session store
set( name, value = null) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of a variable- value
mixedValue of a variable
Response
mixedOld value of a variable
setHandler
Registers session save handler as a PHP session handler
setHandler(\SessionHandlerInterface handler = null) :
| since |
2.0.0 |
|---|---|
| throws |
|
Arguments
- handler
SessionHandlerInterface|nullThe save handler to use
Response
$this
setId
Set the session ID
setId( id) :
| since |
2.0.0 |
|---|---|
| throws |
|
Arguments
- id
stringThe session ID
Response
$this
setName
Set the session name
setName( name) :
| since |
2.0.0 |
|---|---|
| throws |
|
Arguments
- name
stringThe session name
Response
$this
setOptions
Sets session.* ini variables.
setOptions(mixed||string|int options) :
For convenience we omit 'session.' from the beginning of the keys. Explicitly ignores other ini keys.
| note |
Based on \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::setOptions() |
|---|---|
| see |
http://php.net/session.configuration |
| since |
2.0.0 |
Arguments
- options
array<string|int, mixed>Session ini directives array(key => value).
Response
$this
start
Start a session
start() :
| since |
2.0.0 |
|---|
Response
void
Properties
active
Flag if the session is active
| since |
2.0.0 |
|---|
Type(s)
bool
handler
Session save handler
| since |
2.0.0 |
|---|
Type(s)
SessionHandlerInterface
started
Internal flag identifying whether the session has been started
| since |
2.0.0 |
|---|
Type(s)
bool