Ejemplo n.º 1
0
 /**
  * Adds a cookie.
  *
  * @param \AppserverIo\Psr\HttpMessage\CookieInterface $cookie The cookie instance to add
  *
  * @return void
  */
 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;
     }
 }
Ejemplo n.º 2
0
 /**
  * Adds the cookie by name to the cookies array
  *
  * @param CookieInterface $cookie The cookie object
  *
  * @return void
  */
 public function addCookie(CookieInterface $cookie)
 {
     // add's the cookie by name to the cookies array
     $this->cookies[$cookie->getName()] = $cookie;
 }