AttributeBag
in package
implements
AttributeBagInterface, IteratorAggregate, Countable
This class relates to session attribute storage.
Interfaces, Classes, Traits and Enums
- AttributeBagInterface
- Attributes store.
- IteratorAggregate
- Countable
Table of Contents
- $attributes : mixed
- $name : mixed
- $storageKey : mixed
- __construct() : mixed
- all() : array<string|int, mixed>
- Returns attributes.
- clear() : mixed
- {@inheritdoc}
- count() : int
- Returns the number of attributes.
- get() : mixed
- Returns an attribute.
- getIterator() : ArrayIterator
- Returns an iterator for attributes.
- getName() : mixed
- {@inheritdoc}
- getStorageKey() : mixed
- {@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
mixed
$name
= 'attributes'
$storageKey
private
mixed
$storageKey
Methods
__construct()
public
__construct([string $storageKey = '_sf2_attributes' ]) : mixed
Parameters
- $storageKey : string = '_sf2_attributes'
-
The key used to store attributes in the session
Return values
mixed —all()
Returns attributes.
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed> —clear()
{@inheritdoc}
public
clear() : mixed
Return values
mixed —count()
Returns the number of attributes.
public
count() : int
Return values
int —The number of attributes
get()
Returns an attribute.
public
get(mixed $name[, mixed $default = null ]) : mixed
Parameters
- $name : mixed
-
The attribute name
- $default : mixed = null
-
The default value if not found
Return values
mixed —getIterator()
Returns an iterator for attributes.
public
getIterator() : ArrayIterator
Return values
ArrayIterator —An \ArrayIterator instance
getName()
{@inheritdoc}
public
getName() : mixed
Return values
mixed —getStorageKey()
{@inheritdoc}
public
getStorageKey() : mixed
Return values
mixed —has()
Checks if an attribute is defined.
public
has(mixed $name) : bool
Parameters
- $name : mixed
-
The attribute name
Return values
bool —true if the attribute is defined, false otherwise
initialize()
{@inheritdoc}
public
initialize(array<string|int, mixed> &$attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
Return values
mixed —remove()
Removes an attribute.
public
remove(mixed $name) : mixed
Parameters
- $name : mixed
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>
Return values
mixed —set()
Sets an attribute.
public
set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Return values
mixed —setName()
public
setName(mixed $name) : mixed
Parameters
- $name : mixed