public function addCookie(CookieInterface $cookie)
{
// check if this cookie has already been set
if ($this->hasCookie($name = $cookie->getName())) {
// then check if we've already one cookie header available
if (is_array($cookieValue = $this->getCookie($name))) {
$cookieValue[] = $cookie;
} else {
$cookieValue = array($cookieValue, $cookie);
}
// add the cookie array
$this->cookies[$name] = $cookieValue;
} else {
// when add it the first time, simply add it
$this->cookies[$name] = $cookie;
}
}