public function MockArraySessionStorage::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/MockArraySessionStorage.php, line 197

Class

MockArraySessionStorage
MockArraySessionStorage mocks the session for unit tests.

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->started) {
    $this
      ->start();
  }
  return $this->bags[$name];
}