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.php10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index cc6faf1f..40603c90 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -13,16 +13,14 @@ use Craue\ConfigBundle\Util\Config;
13class PocketImport extends AbstractImport 13class PocketImport extends AbstractImport
14{ 14{
15 private $client; 15 private $client;
16 private $consumerKey;
17 private $accessToken; 16 private $accessToken;
18 17
19 const NB_ELEMENTS = 5000; 18 const NB_ELEMENTS = 5000;
20 19
21 public function __construct(EntityManager $em, ContentProxy $contentProxy, Config $craueConfig) 20 public function __construct(EntityManager $em, ContentProxy $contentProxy)
22 { 21 {
23 $this->em = $em; 22 $this->em = $em;
24 $this->contentProxy = $contentProxy; 23 $this->contentProxy = $contentProxy;
25 $this->consumerKey = $craueConfig->get('pocket_consumer_key');
26 $this->logger = new NullLogger(); 24 $this->logger = new NullLogger();
27 } 25 }
28 26
@@ -72,7 +70,7 @@ class PocketImport extends AbstractImport
72 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request', 70 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request',
73 [ 71 [
74 'body' => json_encode([ 72 'body' => json_encode([
75 'consumer_key' => $this->consumerKey, 73 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
76 'redirect_uri' => $redirectUri, 74 'redirect_uri' => $redirectUri,
77 ]), 75 ]),
78 ] 76 ]
@@ -102,7 +100,7 @@ class PocketImport extends AbstractImport
102 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize', 100 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize',
103 [ 101 [
104 'body' => json_encode([ 102 'body' => json_encode([
105 'consumer_key' => $this->consumerKey, 103 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
106 'code' => $code, 104 'code' => $code,
107 ]), 105 ]),
108 ] 106 ]
@@ -131,7 +129,7 @@ class PocketImport extends AbstractImport
131 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get', 129 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get',
132 [ 130 [
133 'body' => json_encode([ 131 'body' => json_encode([
134 'consumer_key' => $this->consumerKey, 132 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
135 'access_token' => $this->accessToken, 133 'access_token' => $this->accessToken,
136 'detailType' => 'complete', 134 'detailType' => 'complete',
137 'state' => 'all', 135 'state' => 'all',