lithium\net\http\Request::cookies()

public method

Add a cookie to header output, or return a single cookie or full cookie list.

NOTE: Cookies values are expected to be scalar. This function will not serialize cookie values. If you wish to store a non-scalar value, you must serialize the data first.

Parameters

  • string $key
  • string $value

Returns

mixed

Source

	public function cookies($key = null, $value = null) {
		if (is_string($key)) {
			if ($value === null) {
				return isset($this->cookies[$key]) ? $this->cookies[$key] : null;
			}
			if ($value === false) {
				unset($this->cookies[$key]);
				return $this->cookies;
			}
		}
		if ($key) {
			$cookies = is_array($key) ? $key : array($key => $value);
			$this->cookies = $cookies + $this->cookies;
		}
		return $this->cookies;
	}