Write cookie

@param string $name The name of the cookie.
@param string|array $value Value of the cookie to set
@param array $config The configuration for the cookie
963104
public function write($name, $value, $config = []) {
        // handle config
        $options = $config + $this->_config;

        // write to cache
        $this->cache[$name] = $value;

        // create cookie
        $cookie = (new Cookie($name))
            ->withValue($value)
            ->withPath($options['path'])
            ->withDomain($options['domain'])
            ->withSecure($options['secure'])
            ->withHttpOnly($options['httpOnly']);

        // handle expire
        if($options['expire'])
            $cookie = $cookie->withExpiry(new DateTime($options['expire']));

        // send with response
        $this->ctrl->setResponse($this->ctrl->getResponse()->withCookie($cookie));
    }
1066419
public function set($name, $value)
    {
        $this->helper()->arr()->set($this->object, $name, $value);
    }
107807
public function set(string $name, $value = null) : void
    {
        Arr::set($this->registry, $name, $value);
    }
474400
protected function add_to_config_log($name, $oldvalue, $value) {
        if ($value !== '') {
            $value = '********';
        }
        if ($oldvalue !== '' and $oldvalue !== null) {
            $oldvalue = '********';
        }
        parent::add_to_config_log($name, $oldvalue, $value);
    }
1247083
public function write($name, $value = null)
    {
        if (!$this->started()) {
            $this->start();
        }

        $write = $name;
        if (!is_array($name)) {
            $write = [$name => $value];
        }

        $data = isset($_SESSION) ? $_SESSION : [];
        foreach ($write as $key => $val) {
            $data = Hash::insert($data, $key, $val);
        }

        $this->_overwrite($_SESSION, $data);
    }
314316
protected function setCookie($name, $value, $expire, $option = [])
    {
        WorkerHttp::setCookie($name, $value, $expire, $option['path'], $option['domain'], $option['secure'], $option['httponly']);
    }
381961
protected function storeOriginalConfiguration($name, $value) {
    if (!isset($this->originalConfiguration[$name])) {
      $this->originalConfiguration[$name] = $value;
    }
  }
1273593
public function cookie($name, $value=null) 
    {
        $str = '';
        if (is_array($name)) {
            $arr = [];
            foreach ($name as $k=>$v) {
                $arr[] = $k . '=' . $v;
            }
            $str = implode(';', $arr);
        } elseif ($value) {
            $str = $name . '=' . $value;
        } else {
            $str = $name;
        }
        
        $this->def['cookie'] = $this->def['cookie'] ? $this->def['cookie'].';'.$str : $str;

        return $this;
    }
26037
public function setVar($name, $value)
    {
        $this->loadVars();
		if ($value === null) {
			unset($this->_config[$name]);
		}
		else {
			$this->_config[$name] = $value;
		}
		$f = fopen(PREFS_FILE,'w');
		foreach($this->_config as $name => $value) {
			if (is_array($value)) continue;
			fwrite($f,$name."=".$value."\n");
		}
		foreach($this->_config as $name => $value) {
			if (!is_array($value)) continue;
			fwrite($f,"\n[".$name."]\n");
			foreach ($value as $key => $val) {
				fwrite($f,$key."=".$val."\n");
			}
		}		
		fclose($f);  			
    }
1306733
public function addCookie($name, $value, $expire = null, $path = null, $domain = null)
    {
        if (!is_null($expire)) {
            $expire = time() + $expire;
        }
        setcookie($name, $value, $expire, $path, $domain);
    }
420850
public function setConfig($name, $key, $value)
    {
        $backup = $this->getDriver()->configGet($name, $key);
        $this->getDriver()->configSet($name, $key, $value);
        if (!array_key_exists($name, $this->config)) {
            $this->config[$name][$key] = $backup;
            return;
        }

        if (!array_key_exists($key, $this->config[$name])) {
            $this->config[$name][$key] = $backup;
        }
    }
684893
protected function setCookie($name, $value = '') {
    if (PHP_SAPI === 'cli') {
      return;
    }

    $current_request = $this->requestStack->getCurrentRequest();
    if (isset($current_request->cookies)) {
      $current_request->cookies->set("Drupal_visitor_{$name}", $value);
    }
    user_cookie_save([
      $name => $value,
    ]);
  }
987062
public function set($name, $value)
    {
        if (! is_array($value)) {
            $value = ['value' => (string) $value];
        }
        $this->responseCookies[$name] = array_replace($this->defaults, $value);
    }
593475
public static function set($name,$value=null)
    {
        if(is_array($name)){
            self::$config=array_merge(self::$config,$name);
            return;
        }
        if(strstr($name,'.')===false){
            self::$config[$name]=$value;
        }else{
            list($l,$r)=explode('.',$name);
            self::$config[$l][$r]=$value;
        }
    }
660432
public function set($name, $value, $expire = 0)
    {
        $cookie_name = $this->getName($name);
        $cookie_expire = time() + ($expire ? $expire : $this->_expire);
        $cookie_value = $this->pack($value, $cookie_expire);
        $cookie_value = $this->authcode($cookie_value, 'ENCODE', $this->_securekey);

        if ($cookie_name && $cookie_value && $cookie_expire) {
            setcookie($cookie_name, $cookie_value, $cookie_expire, '/');
        }

    }
1061435
function setCookie($name, $value)
    {
        if (strlen($name) == 0) {
            return FALSE;
        }
        $this->cookies[] = ['name' => $name, 'value' => $value];

        return TRUE;
    }
1211100
protected function addCookieIntOption($name, $value)
    {
        $value = trim($value);
        if ($value !== null && $value !== '' && is_numeric($value)) {
            $this->addOption('cookie', $name, (int)$value);
        }
    }