You are here

public function MockArraySessionStorage::getBag in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php \Symfony\Component\HttpFoundation\Session\Storage\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

vendor/symfony/http-foundation/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];
}