protected function NamespacedAttributeBag::resolveAttributePath in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php \Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag::resolveAttributePath()
Resolves a path in attributes property and returns it as a reference.
This method allows structured namespacing of session attributes.
Parameters
string $name Key name:
bool $writeContext Write context, default false:
Return value
array
4 calls to NamespacedAttributeBag::resolveAttributePath()
- NamespacedAttributeBag::get in vendor/
symfony/ http-foundation/ Session/ Attribute/ NamespacedAttributeBag.php - Returns an attribute.
- NamespacedAttributeBag::has in vendor/
symfony/ http-foundation/ Session/ Attribute/ NamespacedAttributeBag.php - Checks if an attribute is defined.
- NamespacedAttributeBag::remove in vendor/
symfony/ http-foundation/ Session/ Attribute/ NamespacedAttributeBag.php - Removes an attribute.
- NamespacedAttributeBag::set in vendor/
symfony/ http-foundation/ Session/ Attribute/ NamespacedAttributeBag.php - Sets an attribute.
File
- vendor/
symfony/ http-foundation/ Session/ Attribute/ NamespacedAttributeBag.php, line 109
Class
- NamespacedAttributeBag
- This class provides structured storage of session attributes using a name spacing character in the key.
Namespace
Symfony\Component\HttpFoundation\Session\AttributeCode
protected function &resolveAttributePath($name, $writeContext = false) {
$array =& $this->attributes;
$name = strpos($name, $this->namespaceCharacter) === 0 ? substr($name, 1) : $name;
// Check if there is anything to do, else return
if (!$name) {
return $array;
}
$parts = explode($this->namespaceCharacter, $name);
if (count($parts) < 2) {
if (!$writeContext) {
return $array;
}
$array[$parts[0]] = array();
return $array;
}
unset($parts[count($parts) - 1]);
foreach ($parts as $part) {
if (null !== $array && !array_key_exists($part, $array)) {
$array[$part] = $writeContext ? array() : null;
}
$array =& $array[$part];
}
return $array;
}