Create a new cookie with updated data.

@param string $path Path to write to
@param mixed $value Value to write
@return static
492108
public function withAddedValue($path, $value)
    {
        $new = clone $this;
        if ($new->isExpanded === false) {
            $new->value = $new->_expand($new->value);
        }
        $new->value = Hash::insert($new->value, $path, $value);

        return $new;
    }
1261238
public function set($path, $value)
    {
        // if is readonly
        if ($this->readonly && $this->has($path)) {
            throw new \InvalidArgumentException("Config data have been setting readonly. don't allow change.");
        }

        return parent::set($path, $value);
    }
788687
public function withCookie($name, $value, $expire = 0, $path = '/', $domain = null, $secure = null, $httponly = true)
    {
        if (null === $secure) {
            $secure = isset($_SERVER['HTTPS']) ? (bool) $_SERVER['HTTPS'] : false;
        }

        $key = sprintf('%s@%s:%s', $name, $domain, $path);
        $this->cookies[$key] = [$name, $value, $expire, $path, $domain, $secure, $httponly];

        return $this;
    }
33650
protected function prepareCookie(string $name, string $value)
    {
        return new Cookie(
            $name,
            $value,
            0,
            $this->sessionSettings['cookie']['lifetime'],
            $this->sessionSettings['cookie']['domain'],
            $this->sessionSettings['cookie']['path'],
            $this->sessionSettings['cookie']['secure'],
            $this->sessionSettings['cookie']['httponly']
        );
    }
975669
public function pushIn($key, $path, $value)
    {
        return $this->setIn($key, $path, $value, true);
    }
695645
public function addCookie($key, $value) {

		if(false === is_string($key)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
		}

		if(false === is_string($value)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
		}

		$this -> cookies[] = sprintf('%s=%s', $key, $value);

		return $this;
	}
1348750
protected function setCookie($value, $lifetime, $path = null, $domain = null, $secure = null, $httpOnly = null)
    {
        setcookie(
            $this->options['name'],
            json_encode($value),
            $lifetime,
            $path ?: $this->options['path'],
            $domain ?: $this->options['domain'],
            $secure ?: $this->options['secure'],
            $httpOnly ?: $this->options['http_only']
        );
    }
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;
    }
466588
public function set($key, $value, $expire = 3600, $path = '/')
    {
        if ($expire == false) {
            setcookie($key, serialize($value), false, $path);
        } else {
            setcookie($key, serialize($value), time() + $expire, $path);
        }
    }
872634
protected function createRequest($method, $path, $value = null)
    {
        list($path, $value) = $this->evaluatePathValueArguments(array($path, $value));
        return $this->client->createRequest($method, $this->buildUrl($path), $this->buildOptions($value));
    }
1100105
public function withCookie($key, $value, $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = false)
    {
        $self = clone $this;
        $self->cookies[] = [
            'key'       => $key,
            'value'     => $value,
            'expire'    => $expire,
            'path'      => $path,
            'domain'    => $domain,
            'secure'    => $secure,
            'httponly'  => $httponly,
        ];
        return $self;
    }
1265728
protected function _persist($value, $path, $namespace)
    {
        $table = $this->_table;
        $entity = $table->newEntity();
        $conditions = [
            $table->aliasField('namespace') => $namespace,
            $table->aliasField('path') => $path,
        ];

        if ($table->exists($conditions)) {
            $entity = $table->find()
                ->where($conditions)
                ->first();
        }

        return $table->patchEntity($entity, compact('namespace', 'path', 'value'))
            && $table->save($entity);
    }
965342
private function createCookieWithValue($value)
    {
        return new Cookie(
            $this->cookieSettings->getName(),
            $value,
            $this->cookieSettings->getExpiresTime(),
            $this->cookieSettings->getPath(),
            $this->cookieSettings->getDomain(),
            $this->cookieSettings->isSecure(),
            $this->cookieSettings->isHttpOnly()
        );
    }
262119
public static function set($name, $value, $expire = 0, $path = '/', $domain = '', $secure = '')
	{
		if(!self::$isInit)
		{
			self::init();
		}
		return setcookie($name, $value, is_numeric($expire) ? $expire : self::$expire, '' == $path ? self::$path : $path, '' == $domain ? self::$domain : $domain, '' == $secure ? self::$secure : $secure);
	}
1102254
public function set( $path, $value )
	{
		$parts = explode( '/', trim( $path, '/' ) );

		$config = $this->_config;
		$max = count( $parts ) - 1;

		for( $i = 0; $i < $max; $i++ )
		{
			$val = $config->get( $parts[$i] );

			if( $val instanceof Zend_Config ) {
				$config = $val;
			} else {
				$config = $config->{$parts[$i]} = new Zend_Config( array(), true );
			}
		}

		$config->{$parts[$max]} = $value;
	}
1086741
public function setCookie($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
    {
        $context = $this->_context;

        if ($expire > 0) {
            $current = time();
            if ($expire < $current) {
                $expire += $current;
            }
        }

        $context->cookies[$name] = [
            'name' => $name,
            'value' => $value,
            'expire' => $expire,
            'path' => $path,
            'domain' => $domain,
            'secure' => $secure,
            'httpOnly' => $httpOnly
        ];

        $globals = $this->request->getGlobals();

        $globals->_COOKIE[$name] = $value;

        return $this;
    }
711448
protected function duplicate(Cookie $cookie, $value)
    {
        return new Cookie(
            $cookie->getName(), $value, $cookie->getExpiresTime(),
            $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(),
            $cookie->isHttpOnly(), $cookie->isRaw(), $cookie->getSameSite()
        );
    }