function CookieJar::clear
Same name in this branch
- 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\CookieCode
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));
});
}
}