MetadataBag
in package
implements
SessionBagInterface
Metadata container.
Adds metadata to the session.
Tags
Interfaces, Classes and Traits
- SessionBagInterface
- Session Bag store.
Table of Contents
- CREATED = 'c'
- LIFETIME = 'l'
- UPDATED = 'u'
- $meta : array<string|int, mixed>
- $lastUsed : int
- Unix timestamp.
- $name : string
- $storageKey : string
- $updateThreshold : int
- __construct() : mixed
- clear() : mixed
- Clears out data from bag.
- getCreated() : int
- Gets the created timestamp metadata.
- getLastUsed() : int
- Gets the last used metadata.
- getLifetime() : int
- Gets the lifetime that the session cookie was set with.
- getName() : string
- Gets this bag's name.
- getStorageKey() : string
- Gets the storage key for this bag.
- initialize() : mixed
- Initializes the Bag.
- setName() : mixed
- Sets name.
- stampNew() : mixed
- Stamps a new session's metadata.
- stampCreated() : void
Constants
CREATED
public
mixed
CREATED
= 'c'
LIFETIME
public
mixed
LIFETIME
= 'l'
UPDATED
public
mixed
UPDATED
= 'u'
Properties
$meta
protected
array<string|int, mixed>
$meta
= [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0]
$lastUsed
Unix timestamp.
private
int
$lastUsed
$name
private
string
$name
= '__metadata'
$storageKey
private
string
$storageKey
$updateThreshold
private
int
$updateThreshold
Methods
__construct()
public
__construct([string $storageKey = '_sf2_meta' ], int $updateThreshold) : mixed
Parameters
- $storageKey : string = '_sf2_meta'
-
The key used to store bag in the session
- $updateThreshold : int
-
The time to wait between two UPDATED updates
Return values
mixed —clear()
Clears out data from bag.
public
clear() : mixed
Return values
mixed —Whatever data was contained
getCreated()
Gets the created timestamp metadata.
public
getCreated() : int
Return values
int —Unix timestamp
getLastUsed()
Gets the last used metadata.
public
getLastUsed() : int
Return values
int —Unix timestamp
getLifetime()
Gets the lifetime that the session cookie was set with.
public
getLifetime() : int
Return values
int —getName()
Gets this bag's name.
public
getName() : string
Return values
string —getStorageKey()
Gets the storage key for this bag.
public
getStorageKey() : string
Return values
string —initialize()
Initializes the Bag.
public
initialize(array<string|int, mixed> &$array) : mixed
Parameters
- $array : array<string|int, mixed>
Return values
mixed —setName()
Sets name.
public
setName(string $name) : mixed
Parameters
- $name : string
Return values
mixed —stampNew()
Stamps a new session's metadata.
public
stampNew([int|null $lifetime = null ]) : mixed
Parameters
- $lifetime : int|null = null
-
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 values
mixed —stampCreated()
private
stampCreated([int|null $lifetime = null ]) : void
Parameters
- $lifetime : int|null = null