예제 #1
0
 /**
  * @see CookieManager::addCookie()
  */
 public function addCookie(Cookie $cookie)
 {
     $cookieDomain = $cookie->getDomain();
     if (!isset($this->cookies[$cookieDomain])) {
         $this->cookies[$cookieDomain] = array();
     }
     $this->cookies[$cookieDomain][] = $cookie;
 }
예제 #2
0
파일: CookieTest.php 프로젝트: seytar/psx
 public function testCookie()
 {
     $cookie = new Cookie('DNR=deleted; expires=Tue, 24-Dec-2013 11:39:14 GMT; path=/; domain=.www.yahoo.com');
     $this->assertEquals('DNR', $cookie->getName());
     $this->assertEquals('deleted', $cookie->getValue());
     $this->assertEquals(date('r', strtotime('Tue, 24-Dec-2013 11:39:14 GMT')), $cookie->getExpires()->format('r'));
     $this->assertEquals('/', $cookie->getPath());
     $this->assertEquals('www.yahoo.com', $cookie->getDomain());
 }
예제 #3
0
파일: CookiePool.php 프로젝트: jivoo/http
 /**
  * Add a cookie to the pool.
  *
  * @param Cookie $cookie A cookie.
  */
 public function add(Cookie $cookie)
 {
     if ($cookie instanceof MutableCookie) {
         $this->cookies[$cookie->getName()] = $cookie;
     } elseif ($cookie instanceof ResponseCookie) {
         $this[$cookie->getName()]->set($cookie->get())->setPath($cookie->getPath())->setDomain($cookie->getDomain())->setSecure($cookie->isSecure())->setHttpOnly($cookie->isHttpOnly())->expiresAt($cookie->getExpiration());
     } else {
         $this->cookies[$cookie->getName()] = $this->setDefaults(new MutableCookie($cookie->getName(), $cookie->get()));
     }
 }
예제 #4
0
 /**
  * Sets a cookie.
  *
  * @param Cookie $cookie A Cookie instance
  *
  * @api
  */
 public function set(Cookie $cookie)
 {
     $this->cookieJar[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
 }
예제 #5
0
 /**
  * Sets a cookie.
  *
  * @param Cookie $cookie
  */
 public function setCookie(Cookie $cookie)
 {
     $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
     $this->headerNames['set-cookie'] = 'Set-Cookie';
 }
예제 #6
0
 /**
  * Remove a specific cookie from storage
  *
  * @param Cookie $cookie
  * @return void
  */
 public function remove(Cookie $cookie)
 {
     unset($this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()]);
 }
예제 #7
0
 /**
  * Create cookie.
  */
 public function set(Cookie $cookie)
 {
     return setcookie($cookie->getName(), $cookie->getValue(), $cookie->getTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->getSecure(), true);
 }