interface SessionBridgeInterface (View source)

Interface SessionBridgeInterface

Methods

bool
start()

Starts the session.

bool
isStarted()

Checks if the session is started.

string
getId()

Returns the session ID

void
setId(string $id)

Sets the session ID

mixed
getName()

Returns the session name

void
setName(string $name)

Sets the session name

bool
restart(bool $destroy = false, int $lifetime = null)

Regenerates id that represents this storage.

bool
regenerate(bool $destroy = false)

regenerate

void
save()

Force the session to be saved and closed.

void
destroy()

Clear all session data in memory.

array
getCookieParams()

getCookieParams

setCookieParams(integer $lifetime, string $path = null, string $domain = null, boolean $secure = false, boolean $httponly = true)

Set session cookie parameters, this method should call before session started.

array
getStorage()

getStorage

Details

at line line 25
bool start()

Starts the session.

Return Value

bool True if started.

Exceptions

RuntimeException If something goes wrong starting the session.

at line line 32
bool isStarted()

Checks if the session is started.

Return Value

bool True if started, false otherwise.

at line line 39
string getId()

Returns the session ID

Return Value

string The session ID or empty.

at line line 48
void setId(string $id)

Sets the session ID

Parameters

string $id Set the session id

Return Value

void

at line line 55
mixed getName()

Returns the session name

Return Value

mixed The session name.

at line line 64
void setName(string $name)

Sets the session name

Parameters

string $name Set the name of the session

Return Value

void

at line line 87
bool restart(bool $destroy = false, int $lifetime = null)

Regenerates id that represents this storage.

This method must invoke sessionregenerateid($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.

Note regenerate+destroy should not clear the session data in memory only delete the session data from persistent storage.

Parameters

bool $destroy Destroy session when regenerating?
int $lifetime Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.

Return Value

bool True if session regenerated, false if error

Exceptions

RuntimeException If an error occurs while regenerating this storage

at line line 96
bool regenerate(bool $destroy = false)

regenerate

Parameters

bool $destroy

Return Value

bool

at line line 111
void save()

Force the session to be saved and closed.

This method must invoke sessionwriteclose() unless this interface is used for a storage object design for unit or functional testing where a real PHP session would interfere with testing, in which case it it should actually persist the session data if required.

Return Value

void

Exceptions

RuntimeException If the session is saved without being started, or if the session is already closed.

at line line 118
void destroy()

Clear all session data in memory.

Return Value

void

at line line 125
array getCookieParams()

getCookieParams

Return Value

array

at line line 144
SessionBridgeInterface setCookieParams(integer $lifetime, string $path = null, string $domain = null, boolean $secure = false, boolean $httponly = true)

Set session cookie parameters, this method should call before session started.

Parameters

integer $lifetime Lifetime of the session cookie, defined in seconds.
string $path Path on the domain where the cookie will work. Use a single slash ('/') for all paths on the domain.
string $domain Cookie domain, for example 'www.php.net'. To make cookies visible on all sub domains then the domain must be prefixed with a dot like '.php.net'.
boolean $secure If true cookie will only be sent over secure connections.
boolean $httponly If set to true then PHP will attempt to send the httponly flag when setting the session cookie.

Return Value

SessionBridgeInterface

at line line 151
array getStorage()

getStorage

Return Value

array