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

Breadcrumb

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

function CookieJar::getCookieByName

Finds and returns the cookie based on the name

Parameters

string $name cookie name to search for:

Return value

SetCookie|null cookie that was found or null if not found

File

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

Class

CookieJar
Cookie jar that stores cookies as an array

Namespace

GuzzleHttp\Cookie

Code

public function getCookieByName(string $name) : ?SetCookie {
    foreach ($this->cookies as $cookie) {
        if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) {
            return $cookie;
        }
    }
    return null;
}

API Navigation

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