class NamespacedAttributeBag extends AttributeBag

This class provides structured storage of session attributes using a name spacing character in the key.

Methods

__construct(string $storageKey = '_sf2_attributes', string $namespaceCharacter = '/')

Constructor.

string
getName()

Gets this bag's name

setName($name)

No description

initialize(array $attributes)

Initializes the Bag

string
getStorageKey()

Gets the storage key for this bag.

Boolean
has(string $name)

Checks if an attribute is defined.

mixed
get(string $name, mixed $default = null)

Returns an attribute.

set(string $name, mixed $value)

Sets an attribute.

array
all()

Returns attributes.

replace(array $attributes)

Sets attributes.

mixed
remove(string $name)

Removes an attribute.

mixed
clear()

Clears out data from bag.

getIterator()

Returns an iterator for attributes.

int
count()

Returns the number of attributes.

Details

at line line 35
__construct(string $storageKey = '_sf2_attributes', string $namespaceCharacter = '/')

Constructor.

Parameters

string $storageKey The key used to store attributes in the session.
string $namespaceCharacter Namespace character to use in keys.

in AttributeBag at line line 44
string getName()

Gets this bag's name

Return Value

string

in AttributeBag at line line 49
setName($name)

Parameters

$name

in AttributeBag at line line 57
initialize(array $attributes)

Initializes the Bag

Parameters

array $attributes

in AttributeBag at line line 65
string getStorageKey()

Gets the storage key for this bag.

Return Value

string

at line line 44
Boolean has(string $name)

Checks if an attribute is defined.

Parameters

string $name The attribute name

Return Value

Boolean true if the attribute is defined, false otherwise

at line line 59
mixed get(string $name, mixed $default = null)

Returns an attribute.

Parameters

string $name The attribute name
mixed $default The default value if not found.

Return Value

mixed

at line line 74
set(string $name, mixed $value)

Sets an attribute.

Parameters

string $name
mixed $value

in AttributeBag at line line 97
array all()

Returns attributes.

Return Value

array Attributes

in AttributeBag at line line 105
replace(array $attributes)

Sets attributes.

Parameters

array $attributes Attributes

at line line 84
mixed remove(string $name)

Removes an attribute.

Parameters

string $name

Return Value

mixed The removed value

in AttributeBag at line line 130
mixed clear()

Clears out data from bag.

Return Value

mixed Whatever data was contained.

in AttributeBag at line line 143
ArrayIterator getIterator()

Returns an iterator for attributes.

Return Value

ArrayIterator An \ArrayIterator instance

in AttributeBag at line line 153
int count()

Returns the number of attributes.

Return Value

int The number of attributes