Create a new cookie.

@param  string $name
@param  string $value
@param  int    $minutes
@param  string $path
@param  string $domain
@param  bool   $encrypt
@param  bool   $httpOnly
@return bool
175370
public function make($name, $value, $minute = null, $path = "/", $domain = null, $secure = null, $httpOnly = true)
    {
        $this->toString = $value;
        if ($minute === 0) {
            $timez = 0;
        } else {
            $timez = time() + ($minute * 60);
        }
        if ($secure===null and isset($_SERVER['HTTPS'])) {
            $secure = true;
        }
        if ($domain===null) {
            $domain = Configer::getCookieDefaultDomain();
        }
        $this->func        = function ($value) use ($name, $timez, $path, $domain, $secure, $httpOnly) {
            setcookie($name, $value, $timez, $path, $domain, $secure, $httpOnly);
        };
        return new InputUtilities($this->toString, $this->func);
    }
31310
public function cookie($name, $value, $expires = 0, $path = '', $domain = '', $secure = false, $httpOnly = false)
    {
        $cookie = new Cookie(
            $name,
            $value,
            $expires
        );

        return $cookie
            ->setPath($path)
            ->setDomain($domain)
            ->setIsSecure($secure)
            ->setIsHttpOnly($httpOnly)
            ->commit();
    }
241448
public function setRequestCookie($request, $name, $value = null)
    {
        if (empty($name)) {
            return false;
        }

        $request = FigRequestCookies::set($request, Cookie::create($name, $value));

        return $request;
    }
281006
public function setCookie(
        $cookie_key,
        $cookie_value,
        $expire = null,
        $path = null,
        $domain = null,
        $secure = null,
        $httpOnly = null
    )
    {
        setcookie($cookie_key, Lb::app()->encryptByConfig($cookie_value), $expire, $path, $domain, $secure, $httpOnly);
    }
64977
public function setCookie($name, $value)
    {
        if (strlen($name) == 0) {
            return false;
        }
        $this->cookies[] = array('name' => $name, 'value' => $value);
        return true;
    }
768786
public static function cookie($name, $value = null, $expire = null, $path = null, $domain = null, $security = null) {
        $settings       = App::cfg();
        $cookie_setting = array_merge2([
            'expire'   => 0,
            'path'     => '/',
            'domain'   => '',
            'security' => false
        ], $settings->get('cookie', []));
        if ($expire == null) {
            $expire = intval($cookie_setting ['expire']);
        }
        if ($path == null) {
            $path = $cookie_setting ['path'];
        }
        if ($domain == null) {
            $domain = $cookie_setting ['domain'];
        }
        if ($security == null) {
            $security = $cookie_setting ['security'];
        }
        if ($expire != 0) {
            $expire = time() + $expire;
        }
        @setcookie($name, $value, $expire, $path, $domain, $security);
    }
261164
public static function set($name, $value, $expire = 0, $path = '', $domain = '')
    {
        empty($expire) && $expire = Config::get('cookie_expire');
        empty($path) && $path = Config::get('cookie_path');
        empty($domain) && $domain = Config::get('cookie_domain');

        $expire = empty($expire) ? 0 : Cml::$nowTime + $expire;
        $value = Encry::encrypt($value);
        setcookie(Config::get('cookie_prefix') . $name, $value, $expire, $path, $domain);
        $_COOKIE[Config::get('cookie_prefix') . $name] = $value;
    }
1152074
public function setCookie($name, $data, $expire, $path, $domain, $secure = false, $httpOnly = false) {
		if (!headers_sent()) {
			// set the cookie
			setcookie($name, $data, $expire, $path, $domain, $secure, $httpOnly);
		}
	}
589816
public void setCookie(String name, String value, String path, Date expirationDate, boolean secure, boolean httpOnly) {
        if (remote == null)
            throw new IllegalStateException("Cannot setCookie since remote == null");
        if (path == null || path.length() == 0)
            path = remote.getPath();
        Cookie.Builder builder = new Cookie.Builder();
        builder.name(name).value(value).domain(remote.getHost()).path(path);
        if (expirationDate != null)
            builder.expiresAt(expirationDate.getTime());
        List<Cookie> cookies = Collections.singletonList(builder.build());
        this.clientFactory.addCookies(cookies);
    }
1060174
public static function setCookie($name, $value = '', $maxage = 0, $path = '', $domain = '', $secure = false, $HTTPOnly = false)
    {
        if (PHP_SAPI != 'cli')
        {
            return setcookie($name, $value, $maxage, $path, $domain, $secure, $HTTPOnly);
        }

        HttpCache::$header[] = 'Set-Cookie: ' . $name . '=' . rawurlencode($value)
            . (empty($domain) ? '' : '; Domain=' . $domain)
            . (empty($maxage) ? '' : '; Max-Age=' . $maxage)
            . (empty($path) ? '' : '; Path=' . $path)
            . (! $secure ? '' : '; Secure')
            . (! $HTTPOnly ? '' : '; HttpOnly');
        return true;
    }
1309702
public static function set(
        $name,
        $value,
        $expiry = 90,
        $path = null,
        $domain = null,
        $secure = false,
        $httpOnly = true
    ) {
        return self::get_inst()->set($name, $value, $expiry, $path, $domain, $secure, $httpOnly);
    }
1057558
public function set(
        $name = '',
        $value = '',
        $expire = 0,
        $path = '/',
        $domain = '',
        $secure = false,
        $httpOnly = false
    ) {
        if (empty($value)) {
            Craft::$app->response->cookies->remove($name);
        } else {
            $domain = empty($domain) ? Craft::$app->getConfig()->getGeneral()->defaultCookieDomain : $domain;
            $expire = (int)$expire;
            setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
            $_COOKIE[$name] = $value;
        }
    }
1236706
public final function cookie(string $name, string $value = null)
    {
        return ($value === null) ? $this->getCookie($name) : $this->setCookie($name, $value);
    }
316638
public function add($name, $value = null, array $params = [])
    {
        if (is_array($value)) {
            $params = $value;
            if (isset($params['value'])) {
                $value = $params['value'];
                unset($params['value']);
            } else {
                $value = '';
            }
        }
    
        $params = array_merge($this->defaults, $params);
        $this->jar[$name] = new Cookie($name, $value, $params['expires'], $params['path'], $params['domain'], $params['secure'], $params['httponly'], $params['raw']);
        return $this;
    }
642146
public void setCookie(String name, String value, String path, long maxAge, boolean secure, boolean httpOnly) {
        Date now = new Date();
        Date expirationDate = new Date(now.getTime() + maxAge);
        setCookie(name, value, path, expirationDate, secure, httpOnly);
    }
722362
public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true)
    {
        $this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly));
    }
45635
public function sendCookie(string $name, ?string $value, int $expire = 0,
        string $path = '/', string $domain = '', bool $secure = false, bool $httpOnly = false): void
    {
        // check name
        if (!preg_match('~^[a-z0-9_\-\.]+$~i', $name)) {
            throw new HttpException("Invalid cookie name '{$name}' given");
        }

        $value = (string) $value;
        if ($expire < 0) {
            $value = '';
        }

        setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
    }