If there is already a cookie with the same name in the collection, it will be removed first.
public add ( |
||
$cookie | the cookie to be added |
/** * Returns the cookie collection. * The cookie collection contains the cookies associated with HTTP message. * @return CookieCollection|Cookie[] the cookie collection. */ public function getCookies() { if (!is_object($this->_cookies)) { $cookieCollection = new CookieCollection(); if (is_array($this->_cookies)) { foreach ($this->_cookies as $cookie) { if (!is_object($cookie)) { $cookie = new Cookie($cookie); } $cookieCollection->add($cookie); } } $this->_cookies = $cookieCollection; } return $this->_cookies; }