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

protected method

Render Cookie header, urlencoding invalid characters.

NOTE: Technically '+' is a valid character, but many browsers erroneously convert these to spaces, so we must escape this too.

Returns

string

Source

	protected function _cookies() {
		$cookies = $this->cookies;
		$invalid = str_split(",; \+\t\r\n\013\014");
		$replace = array_map('rawurlencode', $invalid);

		foreach ($cookies as $key => &$value) {
			if (!is_scalar($value)) {
				$message = "Non-scalar value cannot be rendered for cookie `{$key}`";
				throw new UnexpectedValueException($message);
			}
			$value = strtr($value, array_combine($invalid, $replace));
			$value = "{$key}={$value}";
		}
		return implode('; ', $cookies);
	}