/** * @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; }
/** * Serialize value. * @param array $value * @return array|string */ protected function serialize($value) { if (!is_array($value)) { return $value; } return Serialize::serialize($value, $this->serializer); }