public function getFieldValue() { $dirs = $this->getDirectives(); $dirs['charset'] = $this->charset; $dirs['boundary'] = $this->boundary; $str = Directives::getDirectiveString($dirs); return $str == '' ? (string) $this->mediaType : $this->mediaType . '; ' . $str; }
public function getFieldValue() { $buffer = sprintf('%s=%s', Uri::encode($this->name), Uri::encode($this->value)); $dirs = []; // Do not send expires=0 because it is not handled correctly by IE! // Leaving out an expires directive will cause the cookie to be a session cookie. if ($this->expires !== NULL) { $dirs['expires'] = $this->expires->format(Http::DATE_COOKIE); } $dirs['path'] = $this->path; $dirs['domain'] = $this->domain; $dirs['httpOnly'] = $this->httpOnly; $dirs['secure'] = $this->secure; $dirs['discard'] = $this->discard; $dirs['version'] = 1; $str = Directives::getDirectiveString($dirs, ';', ['domain', 'path']); return $str == '' ? $buffer : $buffer . '; ' . $str; }