From 990adfb34c148e7cd28b9cb784cf2b7388caae8f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 26 Sep 2016 07:30:02 +0200 Subject: Move prepareEntry to dedicated place Yeah first try was ugly, now each part are in the dedicated place. Also, the date is hardly truncated to 10 chars because Firefox date are 16 chars long and Chrome are 17 chars long. So instead of divised them by a huge number, I prefer to truncate them. --- src/Wallabag/ImportBundle/Import/FirefoxImport.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Wallabag/ImportBundle/Import/FirefoxImport.php') diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index 1a0b1154..e010f5a4 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php @@ -29,4 +29,25 @@ class FirefoxImport extends BrowserImport { return 'import.firefox.description'; } + + /** + * {@inheritdoc} + */ + protected function prepareEntry(array $entry = []) + { + $data = [ + 'title' => $entry['title'], + 'html' => '', + 'url' => $entry['uri'], + 'is_archived' => $this->markAsRead, + 'tags' => '', + 'created_at' => substr($entry['dateAdded'], 0, 10), + ]; + + if (array_key_exists('tags', $entry) && $entry['tags'] != '') { + $data['tags'] = $entry['tags']; + } + + return $data; + } } -- cgit v1.2.3