You are here

public function SessionCookieJar::save in Zircon Profile 8.0

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

Save cookies to the client session

1 call to SessionCookieJar::save()
SessionCookieJar::__destruct in vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
Saves cookies to session when shutting down

File

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

Class

SessionCookieJar
Persists cookies in the client session

Namespace

GuzzleHttp\Cookie

Code

public function save() {
  $json = [];
  foreach ($this as $cookie) {

    /** @var SetCookie $cookie */
    if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
      $json[] = $cookie
        ->toArray();
    }
  }
  $_SESSION[$this->sessionKey] = json_encode($json);
}