NativeStorage

Implements StorageInterface

Base class providing a session store

since

2.0.0

package

Joomla Framework

Methods

__construct

Constructor

__construct(\SessionHandlerInterface handler = null, array options = []) : mixed
since

1.0

Arguments

handler

\SessionHandlerInterfaceSession save handler

options

arraySession options

Response

mixed

abort

Aborts the current session

abort() : bool
see session_abort()
since

2.0.0

Response

bool

all

Retrieves all variables from the session store

all() : array
since

2.0.0

Response

array

clear

Clears all variables from the session store

clear() : void
since

2.0.0

close

Writes session data and ends session

close() : void
see session_write_close()
since

2.0.0

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(string name, mixed default) : mixed
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() : string
since

2.0.0

Response

stringThe session ID

getName

Get the session name

getName() : string
since

2.0.0

Response

stringThe session name

has

Check whether data exists in the session store

has(string name) : bool
since

2.0.0

Arguments

name

stringName of variable

Response

bool

isActive

Check if the session is active

isActive() : bool
since

2.0.0

Response

bool

isStarted

Check if the session is started

isStarted() : bool
since

2.0.0

Response

bool

regenerate

Regenerates the session ID that represents this storage.

regenerate(bool destroy = false) : bool

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(string name) : mixed
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(string name, mixed value = null) : mixed
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) : $this
since

2.0.0

throws

\RuntimeException

Arguments

handler

\SessionHandlerInterfaceThe save handler to use

Response

$this

setId

Set the session ID

setId(string id) : $this
since

2.0.0

throws

\LogicException

Arguments

id

stringThe session ID

Response

$this

setName

Set the session name

setName(string name) : $this
since

2.0.0

throws

\LogicException

Arguments

name

stringThe session name

Response

$this

setOptions

Sets session.* ini variables.

setOptions(array options) : $this

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

arraySession ini directives array(key => value).

Response

$this

start

Start a session

start() : void
since

2.0.0

Properties

active

Flag if the session is active

since

2.0.0

Type(s)

bool

closed

Internal flag identifying whether the session has been closed

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