@param Cookie $cookie

@return $this|HttpTrait|static
348624
public function clearCookie(Cookie $cookie) : self
    {
        $cookie->setExpire(1);

        $this->cookies[$cookie->getName()] = $cookie;

        return $this;
    }
1124693
public HttpMessage cookie(final Cookie cookie) {
        this.cookies.put(cookie.getName(), cookie);

        setHeader(
                HttpMessageHeaders.HTTP_COOKIE_PREFIX + cookie.getName(),
                cookieConverter.getCookieString(cookie));

        return this;
    }
419584
protected function setCookie($cookie)
    {
        $this->cookie = trim(base64_encode(mcrypt_encrypt(
            MCRYPT_RIJNDAEL_256, '7e2d20j23a21db9f', $cookie, MCRYPT_MODE_ECB, $this->config->getSecret()
        )));

        setcookie($this->config->getCookieName(), $this->cookie, (time() + 60 * 5), null, null, null, true);

        return $this;
    }
621083
public static DefaultCookie convertWisdomCookieToNettyCookie(Cookie cookie) {
        DefaultCookie nettyCookie = new DefaultCookie(cookie.name(), cookie.value());
        nettyCookie.setMaxAge(cookie.maxAge());
        // Comments are not supported anymore by netty.
        if (cookie.domain() != null) {
            nettyCookie.setDomain(cookie.domain());
        }
        if (cookie.isSecure()) {
            nettyCookie.setSecure(true);
        }
        if (cookie.path() != null) {
            nettyCookie.setPath(cookie.path());
        }
        if (cookie.isHttpOnly()) {
            nettyCookie.setHttpOnly(true);
        }
        return nettyCookie;
    }
666952
public function getCookie(): ?Factory
    {
        if (!$this->hasCookie()) {
            $this->setCookie($this->getDefaultCookie());
        }
        return $this->cookie;
    }
207042
private function encryptCookie($cookie)
    {
        $data = base64_encode(serialize($cookie));
        $enc = $this->kernel->getContainer()->get('encryption');
        return $enc->input($data)->key($this->kernel->getContainer()->getParameter('app_key'))->encrypt('enc_reversible_pkey')->output();
    }
148333
public function applyCookies($cookies)
    {
        $values = [];
        foreach ($cookies as $cookie) {
            if ($cookie->matches($this->url())) {
                $values[$cookie->path()] = $cookie->name() . '=' . $cookie->value();
            }
        }

        $keys = array_map('strlen', array_keys($values));
        array_multisort($keys, SORT_DESC, $values);
        $headers = $this->headers();
        if ($values) {
            $headers['Cookie'] = implode('; ', $values);
        } else {
            unset($headers['Cookie']);
        }
        return $this;
    }
1287773
public function add($cookie, array $default = [], bool $nonempty = false): Cookies
    {
        if (!$cookie instanceof Cookie) {
            $cookie = new Cookie($cookie, $default);
        }
        //只允许非空cookie
        if ($nonempty && $cookie->value === '') {
            return $this;
        }

        // php array is a natural high-performance hash table
        // According to chrome's handling, path is only used as a cookie attribute, and the same domain+name is treated as the same cookie.
        $key = $cookie->domain . self::DELIMITER . $cookie->name;
        if (isset($this->raw[$key])) {
            //重置排序(tip:这会消耗很多性能)
            unset($this->raw[$key]);
        }
        $this->raw[$key] = $cookie;

        return $this;
    }
1093212
public function setCookie(Cookie $cookie)
    {
        $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
    }
188971
public function with_cookie( $cookie ) {
		if ( is_string( $cookie ) ) {
			$cookie = call_user_func_array( [ $this, 'create_cookie' ], func_get_args() );
		}

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

		return $this;
	}
631796
public function setAdditionalCookie($cookie, $expectedValue = false)
    {
        $additionalCookie = $this->_getData('_additional_cookie');
        if (!$additionalCookie || !is_array($additionalCookie)) {
            $additionalCookie = array();
        }

        $additionalCookie[$cookie] = $expectedValue;
        $this->setData('_additional_cookie', $additionalCookie);
        return $this;
    }
38656
public function withCookieParams(array $cookies)
    {
        if ($this->getCookieParams() === $cookies) {
            return $this;
        }

        $newInstance = clone $this;
        $newInstance->setCookieParams($cookies);
        return $newInstance;
    }
347306
public function createCookie($cookie = true)
    {
        if ($cookie) {
            $cookietime = time() + (60 * 60 * 24 * 365);
            setcookie($this->_sessionName . "_SessionID", $this->_session->SessionID, $cookietime);
            setcookie($this->_sessionName . "_Timestamp", $this->_session->Timestamp, $cookietime);
        }

        return $this;
    }
1225165
public function setCookie($cookies = [])
    {
        $this->cookies = $cookies;
        $this->debug->info(__FUNCTION__, 'setCookie: ', $this->cookies);

        return $this;
    }
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));
    }
1160984
public String setCookie(final String cookie) {
        final String prev = this.cookie;
        this.cookie = cookie;
        return prev;
    }
680097
function setAllCookies(array $cookies)
    {
        // Must do this for PHP 5.3 compat.
        $cookies_max_age = $this->cookies_max_age;
        $this->cookievars = array_map(
            function($cookieval) use ($cookies_max_age) {
                return array(
                    'value' => $cookieval,
                    'max_age' => $cookies_max_age,
                );
            },
            $cookies
        );
        return $this;
    }