From 3ef055ced3d6ea0d2f15ba660602545f477e9c3c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 9 Oct 2017 16:47:15 +0200 Subject: CS --- src/Wallabag/ImportBundle/Import/AbstractImport.php | 2 +- src/Wallabag/ImportBundle/Import/BrowserImport.php | 2 +- src/Wallabag/ImportBundle/Import/ChromeImport.php | 2 +- src/Wallabag/ImportBundle/Import/FirefoxImport.php | 2 +- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 6 +++--- src/Wallabag/ImportBundle/Import/PocketImport.php | 12 ++++++------ src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/Wallabag/ImportBundle') diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index cb46db09..58a234f4 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php @@ -165,7 +165,7 @@ abstract class AbstractImport implements ImportInterface $entryToBeFlushed[] = $entry; // flush every 20 entries - if (($i % 20) === 0) { + if (0 === ($i % 20)) { $this->em->flush(); foreach ($entryToBeFlushed as $entry) { diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 78077324..b5593180 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -171,7 +171,7 @@ abstract class BrowserImport extends AbstractImport $entryToBeFlushed[] = $entry; // flush every 20 entries - if (($i % 20) === 0) { + if (0 === ($i % 20)) { $this->em->flush(); foreach ($entryToBeFlushed as $entry) { diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php index e3ba636a..09183abe 100644 --- a/src/Wallabag/ImportBundle/Import/ChromeImport.php +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php @@ -45,7 +45,7 @@ class ChromeImport extends BrowserImport 'created_at' => substr($entry['date_added'], 0, 10), ]; - if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { + if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index c18e7e93..73269fe1 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php @@ -45,7 +45,7 @@ class FirefoxImport extends BrowserImport 'created_at' => substr($entry['dateAdded'], 0, 10), ]; - if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { + if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 7d70154a..7ab69e7a 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -63,7 +63,7 @@ class InstapaperImport extends AbstractImport $entries = []; $handle = fopen($this->filepath, 'r'); - while (($data = fgetcsv($handle, 10240)) !== false) { + while (false !== ($data = fgetcsv($handle, 10240))) { if ('URL' === $data[0]) { continue; } @@ -80,8 +80,8 @@ class InstapaperImport extends AbstractImport 'url' => $data[0], 'title' => $data[1], 'status' => $data[3], - 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', - 'is_starred' => $data[3] === 'Starred', + 'is_archived' => 'Archive' === $data[3] || 'Starred' === $data[3], + 'is_starred' => 'Starred' === $data[3], 'html' => false, 'tags' => $tags, ]; diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 7d38826b..dddb87f4 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -149,7 +149,7 @@ class PocketImport extends AbstractImport // - first call get 5k offset 0 // - second call get 5k offset 5k // - and so on - if (count($entries['list']) === self::NB_ELEMENTS) { + if (self::NB_ELEMENTS === count($entries['list'])) { ++$run; return $this->import(self::NB_ELEMENTS * $run); @@ -175,7 +175,7 @@ class PocketImport extends AbstractImport */ public function parseEntry(array $importedEntry) { - $url = isset($importedEntry['resolved_url']) && $importedEntry['resolved_url'] !== '' ? $importedEntry['resolved_url'] : $importedEntry['given_url']; + $url = isset($importedEntry['resolved_url']) && '' !== $importedEntry['resolved_url'] ? $importedEntry['resolved_url'] : $importedEntry['given_url']; $existingEntry = $this->em ->getRepository('WallabagCoreBundle:Entry') @@ -194,15 +194,15 @@ class PocketImport extends AbstractImport $this->fetchContent($entry, $url); // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted - $entry->setArchived($importedEntry['status'] === 1 || $this->markAsRead); + $entry->setArchived(1 === $importedEntry['status'] || $this->markAsRead); // 0 or 1 - 1 If the item is starred - $entry->setStarred($importedEntry['favorite'] === 1); + $entry->setStarred(1 === $importedEntry['favorite']); $title = 'Untitled'; - if (isset($importedEntry['resolved_title']) && $importedEntry['resolved_title'] !== '') { + if (isset($importedEntry['resolved_title']) && '' !== $importedEntry['resolved_title']) { $title = $importedEntry['resolved_title']; - } elseif (isset($importedEntry['given_title']) && $importedEntry['given_title'] !== '') { + } elseif (isset($importedEntry['given_title']) && '' !== $importedEntry['given_title']) { $title = $importedEntry['given_title']; } diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index d585d44d..a35c411e 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php @@ -61,7 +61,7 @@ class WallabagV1Import extends WallabagImport $data['html'] = $this->fetchingErrorMessage; } - if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { + if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } -- cgit v1.2.3