SymfonyComponentHttpFoundationSessionStorageNativeSessionStorage

This provides a base class for session attribute storage.

File
vendorSymfonyComponentHttpFoundationSessionStorageNativeSessionStorage.php
Package
Default
Class hierarchy
SymfonyComponentHttpFoundationSessionStorageNativeSessionStorage
Implements
SymfonyComponentHttpFoundationSessionStorageSessionStorageInterface

Tags

author

Drak drak@zikula.org

Properties

$bags

$bags : array<mixed,\Symfony\Component\HttpFoundation\Session\SessionBagInterface>

Array of SessionBagInterface

Type

array<mixed,SymfonyComponentHttpFoundationSessionSessionBagInterface>

Tags

None found

$started

$started : Boolean

Type

Boolean

Tags

None found

$closed

$closed : Boolean

Type

Boolean

Tags

None found

$saveHandler

$saveHandler : \Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy

Type

SymfonyComponentHttpFoundationSessionStorageProxyAbstractProxy

Tags

None found

$metadataBag

$metadataBag : \Symfony\Component\HttpFoundation\Session\Storage\MetadataBag

Type

SymfonyComponentHttpFoundationSessionStorageMetadataBag

Tags

None found

Methods

getSaveHandler()

getSaveHandler() : \Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy

Gets the save handler instance.

Returns

SymfonyComponentHttpFoundationSessionStorageProxyAbstractProxy

Tags

None found

start()

start() : boolean

Starts the session.

Returns

boolean —

True if started.

Tags

None found

getId()

getId() : string

Returns the session ID

Returns

string —

The session ID or empty.

Tags

None found

setId()

setId(string  $id) 

Sets the session ID

Parameters

string $id

Tags

None found

getName()

getName() : mixed

Returns the session name

Returns

mixed —

The session name.

Tags

None found

setName()

setName(string  $name) 

Sets the session name

Parameters

string $name

Tags

None found

regenerate()

regenerate(Boolean  $destroy = false, integer  $lifetime = null) : Boolean

Regenerates id that represents this storage.

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.

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

Parameters

Boolean $destroy

Destroy session when regenerating?

integer $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.

Returns

Boolean —

True if session regenerated, false if error

Tags

None found

save()

save() 

Force the session to be saved and closed.

This method must invoke session_write_close() 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.

Tags

None found

clear()

clear() 

Clear all session data in memory.

Tags

None found

registerBag()

registerBag(\Symfony\Component\HttpFoundation\Session\SessionBagInterface  $bag) 

Registers a SessionBagInterface for use.

Parameters

SymfonyComponentHttpFoundationSessionSessionBagInterface $bag

Tags

None found

getBag()

getBag(string  $name) : \Symfony\Component\HttpFoundation\Session\SessionBagInterface

Gets a SessionBagInterface by name.

Parameters

string $name

Returns

SymfonyComponentHttpFoundationSessionSessionBagInterface

Tags

None found

setMetadataBag()

setMetadataBag(\Symfony\Component\HttpFoundation\Session\Storage\MetadataBag  $metaBag = null) 

Sets the MetadataBag.

Parameters

SymfonyComponentHttpFoundationSessionStorageMetadataBag $metaBag

Tags

None found

getMetadataBag()

getMetadataBag() : \Symfony\Component\HttpFoundation\Session\Storage\MetadataBag

Gets the MetadataBag.

Returns

SymfonyComponentHttpFoundationSessionStorageMetadataBag

Tags

None found

isStarted()

isStarted() : boolean

Checks if the session is started.

Returns

boolean —

True if started, false otherwise.

Tags

None found

setOptions()

setOptions(array  $options) 

Sets session.* ini variables.

For convenience we omit 'session.' from the beginning of the keys. Explicitly ignores other ini keys.

Parameters

array $options

Session ini directives array(key => value).

See also

Tags

None found

setSaveHandler()

setSaveHandler(object  $saveHandler = null) 

Registers save handler as a PHP session handler.

To use internal PHP session save handlers, override this method using ini_set with session.save_handler and session.save_path e.g.

ini_set('session.save_handler', 'files');
ini_set('session.save_path', /tmp');

Parameters

object $saveHandler

Default null means NativeProxy.

See also

Tags

None found

loadSession()

loadSession(array|null  $session = null) 

Load the session with attributes.

After starting the session, PHP retrieves the session from whatever handlers are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()). PHP takes the return value from the read() handler, unserializes it and populates $_SESSION with the result automatically.

Parameters

array|null $session

Tags

None found