From eeabca8090ebf9a084b6b823ddf7c6493b956d4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=89tienne=20Gilli?= Date: Mon, 10 Jul 2017 09:58:18 +0200 Subject: [PATCH 1/1] Make updateAuthor code simpler to read --- .../CoreBundle/Helper/EntriesExport.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index e16168b1..64d82193 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -83,15 +83,17 @@ class EntriesExport */ public function updateAuthor($method) { - $this->author = $method.' authors'; + if ('entry' !== $method) { + $this->author = $method . ' authors'; - if ('entry' === $method) { - $publishedBy = $this->entries[0]->getPublishedBy(); - if (!empty($publishedBy)) { - $this->author = implode(', ', $this->entries[0]->getPublishedBy()); - } else { - $this->author = $this->entries[0]->getDomainName(); - } + return $this; + } + + $this->author = $this->entries[0]->getDomainName(); + + $publishedBy = $this->entries[0]->getPublishedBy(); + if (!empty($publishedBy)) { + $this->author = implode(', ', $publishedBy); } return $this; -- 2.41.0