You are here

public static function CookieJar::fromArray in Auth0 Single Sign On 8.2

Create a new Cookie jar from an associative array and domain.

Parameters

array $cookies Cookies to create the jar from:

string $domain Domain to set the cookies to:

Return value

self

File

vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php, line 45

Class

CookieJar
Cookie jar that stores cookies as an array

Namespace

GuzzleHttp\Cookie

Code

public static function fromArray(array $cookies, $domain) {
  $cookieJar = new self();
  foreach ($cookies as $name => $value) {
    $cookieJar
      ->setCookie(new SetCookie([
      'Domain' => $domain,
      'Name' => $name,
      'Value' => $value,
      'Discard' => true,
    ]));
  }
  return $cookieJar;
}