RuntimeStorage

Implements StorageInterface

Session storage object that stores objects in Runtime memory. This is designed for use in CLI Apps, including unit testing applications in PHPUnit.

since

2.0.0

package

Joomla Framework

Methods

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

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

generateId

Generates a session ID

generateId() : string
since

2.0.0

Response

string

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

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

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

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

data

Internal data store

since

2.0.0

Type(s)

array

id

Session ID

since

2.0.0

Type(s)

string

name

Session Name

since

2.0.0

Type(s)

string

started

Internal flag identifying whether the session has been started

since

2.0.0

Type(s)

bool