function buildHeaderFields()
{
$header = array_merge(array('title' => $this->title), $this->meta);
# optional fields
if ($this->published) {
$header['published'] = $this->published->__toString();
}
if ($this->draft !== null) {
$header['draft'] = $this->draft ? 'yes' : 'no';
}
if ($this->commentsOpen !== null) {
$header['comments'] = $this->commentsOpen ? 'yes' : 'no';
}
if ($this->pingbackOpen !== null) {
$header['pingback'] = $this->pingbackOpen ? 'yes' : 'no';
}
if ($this->author) {
$header['author'] = GBAuthor::gitFormat($this->author);
}
if ($this->tags) {
$header['tags'] = implode(', ', $this->tags);
}
if ($this->categories) {
$header['categories'] = implode(', ', $this->categories);
}
# only set content-type if mimeType is not the same as default for file ext
if ($this->mimeType !== GBMimeType::forFilename($this->name)) {
$header['content-type'] = $this->mimeType;
}
# charset and encoding should be preserved in $this->meta if
# they existed in the first place.
return $header;
}