Пример #1
0
 /**
  * @inheritdoc
  */
 public function add($name, $value)
 {
     if (is_array($value)) {
         $value = Serialize::serialize($value, $this->serializator);
     }
     if (!setcookie($name, $value, $this->expire, $this->path, $this->domain, $this->secure, $this->httpOnly)) {
         throw new CookieException(CookieException::INVALID_SET);
     }
     $_COOKIE[$name] = $value;
 }
Пример #2
0
 /**
  * Serialize value.
  * @param array $value
  * @return array|string
  */
 protected function serialize($value)
 {
     if (!is_array($value)) {
         return $value;
     }
     return Serialize::serialize($value, $this->serializer);
 }