You are here

protected function SessionCookieJar::load in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php \GuzzleHttp\Cookie\SessionCookieJar::load()

Load the contents of the client session into the data array

1 call to SessionCookieJar::load()
SessionCookieJar::__construct in vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
Create a new SessionCookieJar object

File

vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php, line 57

Class

SessionCookieJar
Persists cookies in the client session

Namespace

GuzzleHttp\Cookie

Code

protected function load() {
  $cookieJar = isset($_SESSION[$this->sessionKey]) ? $_SESSION[$this->sessionKey] : null;
  $data = json_decode($cookieJar, true);
  if (is_array($data)) {
    foreach ($data as $cookie) {
      $this
        ->setCookie(new SetCookie($cookie));
    }
  }
  elseif (strlen($data)) {
    throw new \RuntimeException("Invalid cookie data");
  }
}