AttributeBag
in package
implements
AttributeBagInterface, IteratorAggregate, Countable
This class relates to session attribute storage.
Tags
Table of Contents
Interfaces
- AttributeBagInterface
- Attributes store.
- IteratorAggregate
- Countable
Properties
- $attributes : mixed
- $name : string
- $storageKey : string
Methods
- __construct() : mixed
- all() : array<string, mixed>
- Returns attributes.
- clear() : mixed
- {@inheritdoc}
- count() : int
- Returns the number of attributes.
- get() : mixed
- Returns an attribute.
- getIterator() : ArrayIterator<string, mixed>
- Returns an iterator for attributes.
- getName() : string
- {@inheritdoc}
- getStorageKey() : string
- {@inheritdoc}
- has() : bool
- Checks if an attribute is defined.
- initialize() : mixed
- {@inheritdoc}
- remove() : mixed
- Removes an attribute.
- replace() : mixed
- set() : mixed
- Sets an attribute.
- setName() : mixed
Properties
$attributes
protected
mixed
$attributes
= []
$name
private
string
$name
= 'attributes'
$storageKey
private
string
$storageKey
Methods
__construct()
public
__construct([string $storageKey = '_sf2_attributes' ]) : mixed
Parameters
- $storageKey : string = '_sf2_attributes'
-
The key used to store attributes in the session
all()
Returns attributes.
public
all() : array<string, mixed>
Return values
array<string, mixed>clear()
{@inheritdoc}
public
clear() : mixed
count()
Returns the number of attributes.
public
count() : int
Return values
intget()
Returns an attribute.
public
get(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
getIterator()
Returns an iterator for attributes.
public
getIterator() : ArrayIterator<string, mixed>
Return values
ArrayIterator<string, mixed>getName()
{@inheritdoc}
public
getName() : string
Return values
stringgetStorageKey()
{@inheritdoc}
public
getStorageKey() : string
Return values
stringhas()
Checks if an attribute is defined.
public
has(string $name) : bool
Parameters
- $name : string
Return values
boolinitialize()
{@inheritdoc}
public
initialize(array<string|int, mixed> &$attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
remove()
Removes an attribute.
public
remove(string $name) : mixed
Parameters
- $name : string
Return values
mixed —The removed value or null when it does not exist
replace()
public
replace(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
set()
Sets an attribute.
public
set(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
setName()
public
setName(string $name) : mixed
Parameters
- $name : string