Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CookieJar.php

function CookieJar::fromArray

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:

File

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

Class

CookieJar
Cookie jar that stores cookies as an array

Namespace

GuzzleHttp\Cookie

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal