AttributeBag
in package
implements
AttributeBagInterface, IteratorAggregate, Countable
This class relates to session attribute storage.
Tags
Interfaces, Classes and Traits
- AttributeBagInterface
- Attributes store.
- IteratorAggregate
- Countable
Table of Contents
- $attributes : mixed
- $name : mixed
- $storageKey : mixed
- __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() : 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, mixed>
Return values
array<string, mixed> —clear()
{@inheritdoc}
public
clear() : mixed
Return values
mixed —count()
Returns the number of attributes.
public
count() : int
Return values
int —get()
Returns an attribute.
public
get(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
-
The default value if not found
Return values
mixed —getIterator()
Returns an iterator for attributes.
public
getIterator() : ArrayIterator<string, mixed>
Return values
ArrayIterator<string, mixed> —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(string $name) : bool
Parameters
- $name : string
Return values
bool —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(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>
Return values
mixed —set()
Sets an attribute.
public
set(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
Return values
mixed —setName()
public
setName(string $name) : mixed
Parameters
- $name : string