public function write($key, $value = null, array $options = []) {
		$expire = (!isset($options['expire']) && empty($this->_config['expire']));
		$cookieClass = __CLASS__;

		if ($expire && $key !== $this->_config['name']) {
			return null;
		}
		$expires = (isset($options['expire'])) ? $options['expire'] : $this->_config['expire'];

		return function($params) use (&$expires, $cookieClass) {
			$key = $params['key'];
			$value = $params['value'];
			$key = [$key => $value];
			if (is_array($value)) {
				$key = Set::flatten($key);
			}

			foreach ($key as $name => $val) {
				$result = setcookie(
					$cookieClass::keyFormat($name, $this->_config),
					$val,
					strtotime($expires),
					$this->_config['path'],
					$this->_config['domain'],
					$this->_config['secure'],
					$this->_config['httponly']
				);
				if (!$result) {
					throw new RuntimeException("There was an error setting {$name} cookie.");
				}
			}
			return true;
		};
	}
public function write($key, $value = null, array $options = []) {
		$expire = (!isset($options['expire']) && empty($this->_config['expire']));
		$cookieClass = __CLASS__;

		if ($expire && $key !== $this->_config['name']) {
			return null;
		}
		$expires = (isset($options['expire'])) ? $options['expire'] : $this->_config['expire'];

		return function($params) use (&$expires, $cookieClass) {
			$key = $params['key'];
			$value = $params['value'];
			$key = [$key => $value];
			if (is_array($value)) {
				$key = Set::flatten($key);
			}

			foreach ($key as $name => $val) {
				$result = setcookie(
					$cookieClass::keyFormat($name, $this->_config),
					$val,
					strtotime($expires),
					$this->_config['path'],
					$this->_config['domain'],
					$this->_config['secure'],
					$this->_config['httponly']
				);
				if (!$result) {
					throw new RuntimeException("There was an error setting {$name} cookie.");
				}
			}
			return true;
		};
	}
public function write ( $ key , $ value = null , array $ options = [ ] ) { $ expire = ( ! isset ( $ options [ 'expire' ] ) && empty ( $ this -> _config [ 'expire' ] ) ) ; $ cookieClass = __CLASS__ ; if ( $ expire && $ key !== $ this -> _config [ 'name' ] ) { return null ; } $ expires = ( isset ( $ options [ 'expire' ] ) ) ? $ options [ 'expire' ] : $ this -> _config [ 'expire' ] ; return function ( $ params ) use ( & $ expires , $ cookieClass ) { $ key = $ params [ 'key' ] ; $ value = $ params [ 'value' ] ; $ key = [ $ key => $ value ] ; if ( is_array ( $ value ) ) { $ key = Set :: flatten ( $ key ) ; } foreach ( $ key as $ name => $ val ) { $ result = setcookie ( $ cookieClass :: keyFormat ( $ name , $ this -> _config ) , $ val , strtotime ( $ expires ) , $ this -> _config [ 'path' ] , $ this -> _config [ 'domain' ] , $ this -> _config [ 'secure' ] , $ this -> _config [ 'httponly' ] ) ; if ( ! $ result ) { throw new RuntimeException ( "There was an error setting {$name} cookie." ) ; } } return true ; } ; }
Write a value to the cookie store.

@param string $key Key of the item to be stored.
@param mixed $value The value to be stored.
@param array $options Options array.
@return \Closure Function returning boolean `true` on successful write, `false` otherwise.
Write a value to the cookie store .