aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Import/PocketImport.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/PocketImport.php')
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 29361a32..798cfdae 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -2,7 +2,6 @@
2 2
3namespace Wallabag\ImportBundle\Import; 3namespace Wallabag\ImportBundle\Import;
4 4
5use Psr\Log\LoggerInterface;
6use Psr\Log\NullLogger; 5use Psr\Log\NullLogger;
7use Doctrine\ORM\EntityManager; 6use Doctrine\ORM\EntityManager;
8use GuzzleHttp\Client; 7use GuzzleHttp\Client;
@@ -12,12 +11,9 @@ use Wallabag\CoreBundle\Entity\Entry;
12use Wallabag\CoreBundle\Helper\ContentProxy; 11use Wallabag\CoreBundle\Helper\ContentProxy;
13use Craue\ConfigBundle\Util\Config; 12use Craue\ConfigBundle\Util\Config;
14 13
15class PocketImport implements ImportInterface 14class PocketImport extends AbstractImport
16{ 15{
17 private $user; 16 private $user;
18 private $em;
19 private $contentProxy;
20 private $logger;
21 private $client; 17 private $client;
22 private $consumerKey; 18 private $consumerKey;
23 private $skippedEntries = 0; 19 private $skippedEntries = 0;
@@ -34,11 +30,6 @@ class PocketImport implements ImportInterface
34 $this->logger = new NullLogger(); 30 $this->logger = new NullLogger();
35 } 31 }
36 32
37 public function setLogger(LoggerInterface $logger)
38 {
39 $this->logger = $logger;
40 }
41
42 /** 33 /**
43 * {@inheritdoc} 34 * {@inheritdoc}
44 */ 35 */
@@ -219,14 +210,20 @@ class PocketImport implements ImportInterface
219 } 210 }
220 211
221 $entry = new Entry($this->user); 212 $entry = new Entry($this->user);
222 $entry = $this->contentProxy->updateEntry($entry, $url); 213 $entry = $this->fetchContent($entry, $url);
214
215 // jump to next entry in case of problem while getting content
216 if (false === $entry) {
217 ++$this->skippedEntries;
218 continue;
219 }
223 220
224 // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted 221 // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted
225 if ($pocketEntry['status'] == 1 || $this->markAsRead) { 222 if ($pocketEntry['status'] == 1 || $this->markAsRead) {
226 $entry->setArchived(true); 223 $entry->setArchived(true);
227 } 224 }
228 225
229 // 0 or 1 - 1 If the item is favorited 226 // 0 or 1 - 1 If the item is starred
230 if ($pocketEntry['favorite'] == 1) { 227 if ($pocketEntry['favorite'] == 1) {
231 $entry->setStarred(true); 228 $entry->setStarred(true);
232 } 229 }