class NamespacedAttributeBag extends AttributeBag
This class provides structured storage of session attributes using a name spacing character in the key.
protected | $attributes | from AttributeBag |
__construct(string $storageKey = '_sf2_attributes', string $namespaceCharacter = '/') | ||
string | getName() Gets this bag's name. | from AttributeBag |
setName($name) | from AttributeBag | |
initialize(array $attributes) Initializes the Bag. | from AttributeBag | |
string | getStorageKey() Gets the storage key for this bag. | from AttributeBag |
bool | 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. | from AttributeBag |
replace(array $attributes) Sets attributes. | from AttributeBag | |
mixed | remove(string $name) Removes an attribute. | |
mixed | clear() Clears out data from bag. | from AttributeBag |
ArrayIterator | getIterator() Returns an iterator for attributes. | from AttributeBag |
int | count() Returns the number of attributes. | from AttributeBag |
array | resolveAttributePath(string $name, bool $writeContext = false) Resolves a path in attributes property and returns it as a reference. | |
string | resolveKey(string $name) Resolves the key from the name. |
string | $storageKey | The key used to store attributes in the session |
string | $namespaceCharacter | Namespace character to use in keys |
Gets this bag's name.
string |
$name |
Initializes the Bag.
array | $attributes |
Gets the storage key for this bag.
string |
Checks if an attribute is defined.
string | $name | The attribute name |
bool | true if the attribute is defined, false otherwise |
Returns an attribute.
string | $name | The attribute name |
mixed | $default | The default value if not found |
mixed |
Sets an attribute.
string | $name | |
mixed | $value |
Returns attributes.
array | Attributes |
Sets attributes.
array | $attributes | Attributes |
Removes an attribute.
string | $name |
mixed | The removed value or null when it does not exist |
Clears out data from bag.
mixed | Whatever data was contained |
Returns an iterator for attributes.
ArrayIterator | An \ArrayIterator instance |
Returns the number of attributes.
int | The number of attributes |
Resolves a path in attributes property and returns it as a reference.
This method allows structured namespacing of session attributes.
string | $name | Key name |
bool | $writeContext | Write context, default false |
array |
Resolves the key from the name.
This is the last part in a dot separated string.
string | $name |
string |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.html