public function toHeaderLine() : string
  {
    $cookie = sprintf('%s=%s', $this->name, urlencode($this->value));
    
    if ($this->expires !== 0) {
      $cookie .= sprintf('; expires=%s', gmdate('D, d-M-Y H:i:s T', $this->expires));
    }

    if (!empty($this->path)) {
      $cookie .= sprintf('; path=%s', $this->path);
    }

    if (!empty($this->domain)) {
      $cookie .= sprintf('; domain=%s', $this->domain);
    }

    if (!empty($this->secure)) {
      $cookie .= '; secure';
    }

    if (!empty($this->httpOnly)) {
      $cookie .= '; httponly';
    }

    return $cookie;
  }