framework/web/CookieCollection.php
public function add($cookie)
    {
        if ($this->readOnly) {
            throw new InvalidCallException('The cookie collection is read only.');
        }
        $this->_cookies[$cookie->name] = $cookie;
    }
public function add($cookie)
    {
        if ($this->readOnly) {
            throw new InvalidCallException('The cookie collection is read only.');
        }
        $this->_cookies[$cookie->name] = $cookie;
    }
Adds a cookie to the collection.
If there is already a cookie with the same name in the collection, it will be removed first.
@param Cookie $cookie the cookie to be added
@throws InvalidCallException if the cookie collection is read only