diff options
author | Jerome Charaoui <jerome@riseup.net> | 2016-12-06 22:17:44 -0500 |
---|---|---|
committer | Jeremy Benoist <jbenoist@20minutes.fr> | 2017-06-01 09:43:01 +0200 |
commit | 7aba665e484c5c36ee029219a999a427d864ff22 (patch) | |
tree | 9ac57748d91cee32848b5e961e293e1c9a1fa61f /src/Wallabag/CoreBundle/Controller/EntryController.php | |
parent | 2a0eec07a5630401a9ceb7add65604f79238f10c (diff) | |
download | wallabag-7aba665e484c5c36ee029219a999a427d864ff22.tar.gz wallabag-7aba665e484c5c36ee029219a999a427d864ff22.tar.zst wallabag-7aba665e484c5c36ee029219a999a427d864ff22.zip |
Avoid returning objects passed by reference.
Objects are always passed by reference, so it doesn't make sense to
return an object which is passed by reference as it will always be the
same object. This change makes the code a bit more readable.
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 8d2ac6d4..6018dfac 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -53,12 +53,10 @@ class EntryController extends Controller | |||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Fetch content and update entry. | 55 | * Fetch content and update entry. |
56 | * In case it fails, entry will return to avod loosing the data. | 56 | * In case it fails, $entry->getContent will return an error message. |
57 | * | 57 | * |
58 | * @param Entry $entry | 58 | * @param Entry $entry |
59 | * @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded | 59 | * @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded |
60 | * | ||
61 | * @return Entry | ||
62 | */ | 60 | */ |
63 | private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved') | 61 | private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved') |
64 | { | 62 | { |
@@ -68,7 +66,7 @@ class EntryController extends Controller | |||
68 | $message = 'flashes.entry.notice.'.$prefixMessage; | 66 | $message = 'flashes.entry.notice.'.$prefixMessage; |
69 | 67 | ||
70 | try { | 68 | try { |
71 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); | 69 | $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); |
72 | } catch (\Exception $e) { | 70 | } catch (\Exception $e) { |
73 | $this->get('logger')->error('Error while saving an entry', [ | 71 | $this->get('logger')->error('Error while saving an entry', [ |
74 | 'exception' => $e, | 72 | 'exception' => $e, |
@@ -79,8 +77,6 @@ class EntryController extends Controller | |||
79 | } | 77 | } |
80 | 78 | ||
81 | $this->get('session')->getFlashBag()->add('notice', $message); | 79 | $this->get('session')->getFlashBag()->add('notice', $message); |
82 | |||
83 | return $entry; | ||
84 | } | 80 | } |
85 | 81 | ||
86 | /** | 82 | /** |