You are here

public function NamespacedAttributeBag::get in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php \Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag::get()

Returns an attribute.

Parameters

string $name The attribute name:

mixed $default The default value if not found:

Return value

mixed

Overrides AttributeBag::get

File

vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php, line 60

Class

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

Namespace

Symfony\Component\HttpFoundation\Session\Attribute

Code

public function get($name, $default = null) {

  // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
  $attributes = $this
    ->resolveAttributePath($name);
  $name = $this
    ->resolveKey($name);
  if (null === $attributes) {
    return $default;
  }
  return array_key_exists($name, $attributes) ? $attributes[$name] : $default;
}