From 2c61db30b737685ae9102ec10f2371778fb13f1a Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 21 Sep 2016 18:00:08 +0200 Subject: cs & fixes --- .../ImportBundle/Controller/ChromeController.php | 4 ++-- .../ImportBundle/Controller/FirefoxController.php | 4 ++-- src/Wallabag/ImportBundle/Import/BrowserImport.php | 9 +++------ src/Wallabag/ImportBundle/Import/ChromeImport.php | 10 +--------- src/Wallabag/ImportBundle/Import/FirefoxImport.php | 20 ++++++-------------- 5 files changed, 14 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/Wallabag/ImportBundle/Controller/ChromeController.php b/src/Wallabag/ImportBundle/Controller/ChromeController.php index e4cc322a..454f3347 100644 --- a/src/Wallabag/ImportBundle/Controller/ChromeController.php +++ b/src/Wallabag/ImportBundle/Controller/ChromeController.php @@ -15,9 +15,9 @@ class ChromeController extends BrowserController $service = $this->get('wallabag_import.chrome.import'); if ($this->get('craue_config')->get('import_with_rabbitmq')) { - $service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v1_producer')); + $service->setProducer($this->get('old_sound_rabbit_mq.import_chrome_producer')); } elseif ($this->get('craue_config')->get('import_with_redis')) { - $service->setProducer($this->get('wallabag_import.producer.redis.wallabag_v1')); + $service->setProducer($this->get('wallabag_import.producer.redis.chrome')); } return $service; diff --git a/src/Wallabag/ImportBundle/Controller/FirefoxController.php b/src/Wallabag/ImportBundle/Controller/FirefoxController.php index e0dd8214..c329b9c4 100644 --- a/src/Wallabag/ImportBundle/Controller/FirefoxController.php +++ b/src/Wallabag/ImportBundle/Controller/FirefoxController.php @@ -15,9 +15,9 @@ class FirefoxController extends BrowserController $service = $this->get('wallabag_import.firefox.import'); if ($this->get('craue_config')->get('import_with_rabbitmq')) { - $service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v1_producer')); + $service->setProducer($this->get('old_sound_rabbit_mq.import_firefox_producer')); } elseif ($this->get('craue_config')->get('import_with_redis')) { - $service->setProducer($this->get('wallabag_import.producer.redis.wallabag_v1')); + $service->setProducer($this->get('wallabag_import.producer.redis.firefox')); } return $service; diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index ef7d6d95..3e1cb12b 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -2,9 +2,6 @@ namespace Wallabag\ImportBundle\Import; -use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; -use Doctrine\ORM\EntityManager; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Helper\ContentProxy; @@ -121,7 +118,6 @@ abstract class BrowserImport extends AbstractImport protected function parseEntriesForProducer(array $entries) { foreach ($entries as $importedEntry) { - if ((array) $importedEntry !== $importedEntry) { continue; } @@ -144,14 +140,15 @@ abstract class BrowserImport extends AbstractImport */ public function parseEntry(array $importedEntry) { - if ((!key_exists('guid', $importedEntry) || (!key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) { $this->parseEntries($importedEntry); + return; } if (key_exists('children', $importedEntry)) { $this->parseEntries($importedEntry['children']); + return; } @@ -191,7 +188,7 @@ abstract class BrowserImport extends AbstractImport if (!empty($data['created_at'])) { $dt = new \DateTime(); - $entry->setCreatedAt($dt->setTimestamp($data['created_at']/1000)); + $entry->setCreatedAt($dt->setTimestamp($data['created_at'] / 1000)); } $this->em->persist($entry); diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php index 7936ee2f..941d68d3 100644 --- a/src/Wallabag/ImportBundle/Import/ChromeImport.php +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php @@ -2,13 +2,6 @@ namespace Wallabag\ImportBundle\Import; -use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; -use Doctrine\ORM\EntityManager; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Helper\ContentProxy; - class ChromeImport extends BrowserImport { protected $filepath; @@ -37,7 +30,7 @@ class ChromeImport extends BrowserImport return 'import.chrome.description'; } - /** + /** * {@inheritdoc} */ protected function prepareEntry($entry = []) @@ -58,7 +51,6 @@ class ChromeImport extends BrowserImport return $data; } - /** * {@inheritdoc} */ diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index cbf10b87..351cbef1 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php @@ -2,13 +2,6 @@ namespace Wallabag\ImportBundle\Import; -use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; -use Doctrine\ORM\EntityManager; -use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\UserBundle\Entity\User; -use Wallabag\CoreBundle\Helper\ContentProxy; - class FirefoxImport extends BrowserImport { protected $filepath; @@ -42,7 +35,7 @@ class FirefoxImport extends BrowserImport */ protected function prepareEntry($entry = []) { - $data = [ + $data = [ 'title' => $entry['name'], 'html' => '', 'url' => $entry['url'], @@ -51,13 +44,12 @@ class FirefoxImport extends BrowserImport 'created_at' => $entry['date_added'], ]; - if (array_key_exists('tags', $entry) && $entry['tags'] != '') { - $data['tags'] = $entry['tags']; - } - - return $data; - } + if (array_key_exists('tags', $entry) && $entry['tags'] != '') { + $data['tags'] = $entry['tags']; + } + return $data; + } /** * {@inheritdoc} -- cgit v1.2.3