aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2018-09-05 14:25:32 +0200
committerKevin Decherf <kevin@kdecherf.com>2018-09-05 14:25:32 +0200
commit2a1ceb67b4400f46f4d3067e887ff54aa906f0a2 (patch)
treedf0b695eb99e96dc55b63b27a404080c23421639 /src/Wallabag/ImportBundle
parent685a5d745e2b723a09111d7d31157cced67ea9b4 (diff)
downloadwallabag-2a1ceb67b4400f46f4d3067e887ff54aa906f0a2.tar.gz
wallabag-2a1ceb67b4400f46f4d3067e887ff54aa906f0a2.tar.zst
wallabag-2a1ceb67b4400f46f4d3067e887ff54aa906f0a2.zip
php-cs-fixer
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/BrowserController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/InstapaperController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/PinboardController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/ReadabilityController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagController.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/BrowserImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/InstapaperImport.php4
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php2
10 files changed, 11 insertions, 11 deletions
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index 99056c2c..f9ffe994 100644
--- a/src/Wallabag/ImportBundle/Command/ImportCommand.php
+++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php
@@ -43,7 +43,7 @@ class ImportCommand extends ContainerAwareCommand
43 $user = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username')); 43 $user = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username'));
44 } 44 }
45 45
46 if (!is_object($user)) { 46 if (!\is_object($user)) {
47 throw new Exception(sprintf('User "%s" not found', $input->getArgument('username'))); 47 throw new Exception(sprintf('User "%s" not found', $input->getArgument('username')));
48 } 48 }
49 49
diff --git a/src/Wallabag/ImportBundle/Controller/BrowserController.php b/src/Wallabag/ImportBundle/Controller/BrowserController.php
index 77a7a904..6418925c 100644
--- a/src/Wallabag/ImportBundle/Controller/BrowserController.php
+++ b/src/Wallabag/ImportBundle/Controller/BrowserController.php
@@ -30,7 +30,7 @@ abstract class BrowserController extends Controller
30 $markAsRead = $form->get('mark_as_read')->getData(); 30 $markAsRead = $form->get('mark_as_read')->getData();
31 $name = $this->getUser()->getId() . '.json'; 31 $name = $this->getUser()->getId() . '.json';
32 32
33 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 33 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
34 $res = $wallabag 34 $res = $wallabag
35 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 35 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
36 ->setMarkAsRead($markAsRead) 36 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/InstapaperController.php b/src/Wallabag/ImportBundle/Controller/InstapaperController.php
index 550679c3..f184baf9 100644
--- a/src/Wallabag/ImportBundle/Controller/InstapaperController.php
+++ b/src/Wallabag/ImportBundle/Controller/InstapaperController.php
@@ -31,7 +31,7 @@ class InstapaperController extends Controller
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'instapaper_' . $this->getUser()->getId() . '.csv'; 32 $name = 'instapaper_' . $this->getUser()->getId() . '.csv';
33 33
34 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 34 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
35 $res = $instapaper 35 $res = $instapaper
36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
37 ->setMarkAsRead($markAsRead) 37 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/PinboardController.php b/src/Wallabag/ImportBundle/Controller/PinboardController.php
index 0e57fd41..6f54c69a 100644
--- a/src/Wallabag/ImportBundle/Controller/PinboardController.php
+++ b/src/Wallabag/ImportBundle/Controller/PinboardController.php
@@ -31,7 +31,7 @@ class PinboardController extends Controller
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'pinboard_' . $this->getUser()->getId() . '.json'; 32 $name = 'pinboard_' . $this->getUser()->getId() . '.json';
33 33
34 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 34 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
35 $res = $pinboard 35 $res = $pinboard
36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
37 ->setMarkAsRead($markAsRead) 37 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
index 59de24cb..729a97a3 100644
--- a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
+++ b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
@@ -31,7 +31,7 @@ class ReadabilityController extends Controller
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'readability_' . $this->getUser()->getId() . '.json'; 32 $name = 'readability_' . $this->getUser()->getId() . '.json';
33 33
34 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 34 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
35 $res = $readability 35 $res = $readability
36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
37 ->setMarkAsRead($markAsRead) 37 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagController.php b/src/Wallabag/ImportBundle/Controller/WallabagController.php
index 6e6524b4..d182dd2c 100644
--- a/src/Wallabag/ImportBundle/Controller/WallabagController.php
+++ b/src/Wallabag/ImportBundle/Controller/WallabagController.php
@@ -33,7 +33,7 @@ abstract class WallabagController extends Controller
33 $markAsRead = $form->get('mark_as_read')->getData(); 33 $markAsRead = $form->get('mark_as_read')->getData();
34 $name = $this->getUser()->getId() . '.json'; 34 $name = $this->getUser()->getId() . '.json';
35 35
36 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 36 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
37 $res = $wallabag 37 $res = $wallabag
38 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 38 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
39 ->setMarkAsRead($markAsRead) 39 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php
index b5593180..225f1791 100644
--- a/src/Wallabag/ImportBundle/Import/BrowserImport.php
+++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php
@@ -77,7 +77,7 @@ abstract class BrowserImport extends AbstractImport
77 */ 77 */
78 public function parseEntry(array $importedEntry) 78 public function parseEntry(array $importedEntry)
79 { 79 {
80 if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) { 80 if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) {
81 if ($this->producer) { 81 if ($this->producer) {
82 $this->parseEntriesForProducer($importedEntry); 82 $this->parseEntriesForProducer($importedEntry);
83 83
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
index 7ab69e7a..e4f0970c 100644
--- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php
+++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
@@ -62,7 +62,7 @@ class InstapaperImport extends AbstractImport
62 } 62 }
63 63
64 $entries = []; 64 $entries = [];
65 $handle = fopen($this->filepath, 'r'); 65 $handle = fopen($this->filepath, 'rb');
66 while (false !== ($data = fgetcsv($handle, 10240))) { 66 while (false !== ($data = fgetcsv($handle, 10240))) {
67 if ('URL' === $data[0]) { 67 if ('URL' === $data[0]) {
68 continue; 68 continue;
@@ -72,7 +72,7 @@ class InstapaperImport extends AbstractImport
72 // BUT it can also be the status (since status = folder in Instapaper) 72 // BUT it can also be the status (since status = folder in Instapaper)
73 // and we don't want archive, unread & starred to become a tag 73 // and we don't want archive, unread & starred to become a tag
74 $tags = null; 74 $tags = null;
75 if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) { 75 if (false === \in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) {
76 $tags = [$data[3]]; 76 $tags = [$data[3]];
77 } 77 }
78 78
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index dddb87f4..c1b35b7e 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -149,7 +149,7 @@ class PocketImport extends AbstractImport
149 // - first call get 5k offset 0 149 // - first call get 5k offset 0
150 // - second call get 5k offset 5k 150 // - second call get 5k offset 5k
151 // - and so on 151 // - and so on
152 if (self::NB_ELEMENTS === count($entries['list'])) { 152 if (self::NB_ELEMENTS === \count($entries['list'])) {
153 ++$run; 153 ++$run;
154 154
155 return $this->import(self::NB_ELEMENTS * $run); 155 return $this->import(self::NB_ELEMENTS * $run);
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
index a35c411e..b9bb525a 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
@@ -56,7 +56,7 @@ class WallabagV1Import extends WallabagImport
56 56
57 // In case of a bad fetch in v1, replace title and content with v2 error strings 57 // In case of a bad fetch in v1, replace title and content with v2 error strings
58 // If fetching fails again, they will get this instead of the v1 strings 58 // If fetching fails again, they will get this instead of the v1 strings
59 if (in_array($entry['title'], $this->untitled, true)) { 59 if (\in_array($entry['title'], $this->untitled, true)) {
60 $data['title'] = $this->fetchingErrorMessageTitle; 60 $data['title'] = $this->fetchingErrorMessageTitle;
61 $data['html'] = $this->fetchingErrorMessage; 61 $data['html'] = $this->fetchingErrorMessage;
62 } 62 }