Beispiel #1
0
 /**
  * @param $key
  * @return Cookie
  */
 public function getCookie($key)
 {
     if ($cookieValue = $this->klein->request()->cookies()->get($key)) {
         $cookie = new Cookie();
         $cookie->setName($key);
         $cookie->setValue($cookieValue);
         return $cookie;
     }
     return null;
 }
 public function saveCookie(BrowserSessionEntity $browserSession)
 {
     $config = $this->getConfig();
     $cookie = new Cookie();
     $cookie->setName(BrowserSessionEntity::COOKIE_KEY);
     $cookie->setValue($browserSession->getToken());
     $cookie->setExpiration($browserSession->getExpirationDate());
     $cookie->setPath($config->getPath());
     $cookie->setDomain($config->getDomain());
     $cookie->setIsSecure($config->isSecure());
     $cookie->setIsHttpOnly($config->isHttponly());
     $this->getRouterDriver()->addCookie($cookie);
 }