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

Breadcrumb

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

function CookieJar::clear

Same name in this branch
  1. 11.1.x vendor/symfony/browser-kit/CookieJar.php \Symfony\Component\BrowserKit\CookieJar::clear()

Overrides CookieJarInterface::clear

1 call to CookieJar::clear()
CookieJar::removeCookieIfEmpty in vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
If a cookie already exists and the server asks to set it again with a null value, the cookie must be deleted.

File

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

Class

CookieJar
Cookie jar that stores cookies as an array

Namespace

GuzzleHttp\Cookie

Code

public function clear(?string $domain = null, ?string $path = null, ?string $name = null) : void {
    if (!$domain) {
        $this->cookies = [];
        return;
    }
    elseif (!$path) {
        $this->cookies = \array_filter($this->cookies, static function (SetCookie $cookie) use ($domain) : bool {
            return !$cookie->matchesDomain($domain);
        });
    }
    elseif (!$name) {
        $this->cookies = \array_filter($this->cookies, static function (SetCookie $cookie) use ($path, $domain) : bool {
            return !($cookie->matchesPath($path) && $cookie->matchesDomain($domain));
        });
    }
    else {
        $this->cookies = \array_filter($this->cookies, static function (SetCookie $cookie) use ($path, $domain, $name) {
            return !($cookie->getName() == $name && $cookie->matchesPath($path) && $cookie->matchesDomain($domain));
        });
    }
}

API Navigation

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