Make updateAuthor code simpler to read

This commit is contained in:
Étienne Gilli 2017-07-10 09:58:18 +02:00
parent c57f69d967
commit eeabca8090

View file

@ -83,15 +83,17 @@ class EntriesExport
*/ */
public function updateAuthor($method) public function updateAuthor($method)
{ {
$this->author = $method.' authors'; if ('entry' !== $method) {
$this->author = $method . ' authors';
return $this;
}
$this->author = $this->entries[0]->getDomainName();
if ('entry' === $method) {
$publishedBy = $this->entries[0]->getPublishedBy(); $publishedBy = $this->entries[0]->getPublishedBy();
if (!empty($publishedBy)) { if (!empty($publishedBy)) {
$this->author = implode(', ', $this->entries[0]->getPublishedBy()); $this->author = implode(', ', $publishedBy);
} else {
$this->author = $this->entries[0]->getDomainName();
}
} }
return $this; return $this;