If a cookie already exists and the server asks to set it again with a null value, the
cookie must be deleted.

@param \Guzzle\Plugin\Cookie\Cookie $cookie
338454
private function removeCookieIfEmpty(Cookie $cookie)
    {
        $cookieValue = $cookie->getValue();
        if ($cookieValue === null || $cookieValue === '') {
            $this->remove($cookie->getDomain(), $cookie->getPath(), $cookie->getName());
        }
    }
943138
private function cookieDomainMatchesConfigUrl($cookie)
    {
        if (!array_key_exists('domain', $cookie)) {
            return true;
        }

        $setCookie = new SetCookie();
        $setCookie->setDomain($cookie['domain']);

        return $setCookie->matchesDomain(parse_url($this->config['url'], PHP_URL_HOST));
    }
1239985
public function addCookieDescriptors($cookies)
  {
    $cnt = count($cookies);
    for ($x=0; $x<$cnt; $x++)
    {
      $this->addCookieDescriptor($cookies[$x]);
    }
  }
707290
public static function flush() {
        if (count($_COOKIE) > 0) {
            foreach ($_COOKIE as $key => $value) {
                self::delete($key, '/');
            }
        }
    }
631153
public static function DeleteSessionCookie () {
		if (static::UseCookie()) {
			$cookie_params = static::CookieParams();
			setcookie(
				static::Name(),
				'',
				time() - 42000,
				$cookie_params['path'],
				$cookie_params['domain'],
				$cookie_params['secure'],
				$cookie_params['httponly']
			);
		}
	}
31010
public function setCookie(ResponseCookie $cookie)
    {
        $this->cookies[$cookie->getName()] = $cookie;
        $this->setHeadersFromCookies();
    }
947319
public function has($cookie) {

        if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");

        $name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;

        return array_key_exists($name, $this->cookies);

    }
444617
public function clearCookie($key = null)
    {
        if (!$this->_cookie) {
            $this->_cookie = new Cookie();
            $this->_cookie->setVitex(Vitex::getInstance());
        }
        $this->_cookie->clearCookie($key);
        return $this;
    }
389128
@Override
    public void removeCookie(HttpCookie cookie) {
        this.message.removeCookie(cookie.getName(), HttpHeaderKeys.HDR_SET_COOKIE);
    }
843904
public function delete($cookieName)
    {
        $cookie = $this->cookie->forget($cookieName);
        $this->cookie->queue($cookie);

        return true;
    }
300583
public function cookie(array $cookie) {

        $cookies = '';

        foreach($cookie as $k => $v)

            $cookies .= $k . '=' . $v . ';';

        curl_setopt(self::$handle, CURLOPT_COOKIE, $cookies);

        return $this;
    }
850154
public function cookie($cookie = null) {
        if ($cookie === null) {
            $this->cookies = [];
        } else {
            $this->cookies[] = $cookie;
        }

        return $this;
    }
13934
public function addCookie(KHttpCookie $cookie)
    {
        $this->_cookies[$cookie->domain][(string) $cookie->path][$cookie->name] = $cookie;
    }
1159654
function UpdateCookies($cookies)
    {
        if (sizeof($this->cookies) == 0) {
            // no existing cookies: take whatever is new
            if (sizeof($cookies) > 0) {
                $this->debug('Setting new cookie(s)');
                $this->cookies = $cookies;
            }

            return TRUE;
        }
        if (sizeof($cookies) == 0) {
            // no new cookies: keep what we've got
            return TRUE;
        }
        // merge
        foreach ($cookies as $newCookie) {
            if (!is_array($newCookie)) {
                continue;
            }
            if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
                continue;
            }
            $newName = $newCookie['name'];

            $found = FALSE;
            for ($i = 0; $i < count($this->cookies); $i++) {
                $cookie = $this->cookies[$i];
                if (!is_array($cookie)) {
                    continue;
                }
                if (!isset($cookie['name'])) {
                    continue;
                }
                if ($newName != $cookie['name']) {
                    continue;
                }
                $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
                $domain    = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
                if ($newDomain != $domain) {
                    continue;
                }
                $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
                $path    = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
                if ($newPath != $path) {
                    continue;
                }
                $this->cookies[$i] = $newCookie;
                $found             = TRUE;
                $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
                break;
            }
            if (!$found) {
                $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
                $this->cookies[] = $newCookie;
            }
        }

        return TRUE;
    }
1346021
public void deleteCookie(Cookie cookie) {
        cookies.remove(cookie.name());
        deletePersistedCookie(cookie.name());
    }
1077485
public function withCookie(Cookie $cookie)
    {
        $clone = clone $this;
        $clone->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
        return $clone;
    }
233854
public function withCookie($cookie)
    {
        if (is_string($cookie) && function_exists('cookie')) {
            $cookie = call_user_func_array('cookie', func_get_args());
        }

        $this->headers->setCookie($cookie);

        return $this;
    }