public function NativeSessionStorage::getBag

Gets a SessionBagInterface by name.

Parameters

string $name:

Return value

SessionBagInterface

Throws

\InvalidArgumentException If the bag does not exist

Overrides SessionStorageInterface::getBag

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php, line 253

Class

NativeSessionStorage
This provides a base class for session attribute storage.

Namespace

Symfony\Component\HttpFoundation\Session\Storage

Code

public function getBag($name) {
  if (!isset($this->bags[$name])) {
    throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name));
  }
  if ($this->saveHandler
    ->isActive() && !$this->started) {
    $this
      ->loadSession();
  }
  elseif (!$this->started) {
    $this
      ->start();
  }
  return $this->bags[$name];
}