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() : 
see session_abort()
since

2.0.0

Response

bool

all

Retrieves all variables from the session store

all() : mixed||string|int

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

generateId

Generates a session ID

generateId() : 
since

2.0.0

Response

string

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

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

setId

Set the session ID

setId( id) : 
since

2.0.0

throws

LogicException

Arguments

id

stringThe session ID

Response

$this

setName

Set the session name

setName( name) : 
since

2.0.0

throws

LogicException

Arguments

name

stringThe session name

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

data

Internal data store

since

2.0.0

Type(s)

array<string|int, mixed>

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