public function toHeader() : string
{
$line = parent::toHeader();
if (0 !== $this->expires) {
$line .= '; Expires=' . $this->encodeDate($this->expires);
}
if ('' !== $this->path) {
$line .= '; Path=' . $this->encodePath($this->path);
}
if ('' !== $this->domain) {
$line .= '; Domain=' . $this->domain;
}
if ($this->secure) {
$line .= '; Secure';
}
if ($this->httpOnly) {
$line .= '; HttpOnly';
}
return $line;
}