diff options
author | lizyn <zhiylin@outlook.com> | 2020-02-24 10:04:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 10:04:13 +0800 |
commit | b19df31d78d881a43bcf6b3215e5fc3781e8e8aa (patch) | |
tree | d0d9861694a4b5e5fbfdbeb53c255ecd15fe9328 /src/Wallabag/ImportBundle/Import/BrowserImport.php | |
parent | 4d0c632c70ea50d459c3c55ddda2e0f394dd51cb (diff) | |
parent | 04d918cae0227c06a41d27fb6533dddbf30dfe71 (diff) | |
download | wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.gz wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.zst wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.zip |
Merge pull request #1 from wallabag/master
Keep up with the master again
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/BrowserImport.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/BrowserImport.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 225f1791..ea7afd3d 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 | ||
@@ -89,7 +89,7 @@ abstract class BrowserImport extends AbstractImport | |||
89 | return; | 89 | return; |
90 | } | 90 | } |
91 | 91 | ||
92 | if (array_key_exists('children', $importedEntry)) { | 92 | if (\array_key_exists('children', $importedEntry)) { |
93 | if ($this->producer) { | 93 | if ($this->producer) { |
94 | $this->parseEntriesForProducer($importedEntry['children']); | 94 | $this->parseEntriesForProducer($importedEntry['children']); |
95 | 95 | ||
@@ -101,11 +101,11 @@ abstract class BrowserImport extends AbstractImport | |||
101 | return; | 101 | return; |
102 | } | 102 | } |
103 | 103 | ||
104 | if (!array_key_exists('uri', $importedEntry) && !array_key_exists('url', $importedEntry)) { | 104 | if (!\array_key_exists('uri', $importedEntry) && !\array_key_exists('url', $importedEntry)) { |
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | 107 | ||
108 | $url = array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; | 108 | $url = \array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; |
109 | 109 | ||
110 | $existingEntry = $this->em | 110 | $existingEntry = $this->em |
111 | ->getRepository('WallabagCoreBundle:Entry') | 111 | ->getRepository('WallabagCoreBundle:Entry') |
@@ -126,14 +126,14 @@ abstract class BrowserImport extends AbstractImport | |||
126 | // update entry with content (in case fetching failed, the given entry will be return) | 126 | // update entry with content (in case fetching failed, the given entry will be return) |
127 | $this->fetchContent($entry, $data['url'], $data); | 127 | $this->fetchContent($entry, $data['url'], $data); |
128 | 128 | ||
129 | if (array_key_exists('tags', $data)) { | 129 | if (\array_key_exists('tags', $data)) { |
130 | $this->tagsAssigner->assignTagsToEntry( | 130 | $this->tagsAssigner->assignTagsToEntry( |
131 | $entry, | 131 | $entry, |
132 | $data['tags'] | 132 | $data['tags'] |
133 | ); | 133 | ); |
134 | } | 134 | } |
135 | 135 | ||
136 | $entry->setArchived($data['is_archived']); | 136 | $entry->updateArchived($data['is_archived']); |
137 | 137 | ||
138 | if (!empty($data['created_at'])) { | 138 | if (!empty($data['created_at'])) { |
139 | $dt = new \DateTime(); | 139 | $dt = new \DateTime(); |
@@ -148,10 +148,8 @@ abstract class BrowserImport extends AbstractImport | |||
148 | 148 | ||
149 | /** | 149 | /** |
150 | * Parse and insert all given entries. | 150 | * Parse and insert all given entries. |
151 | * | ||
152 | * @param $entries | ||
153 | */ | 151 | */ |
154 | protected function parseEntries($entries) | 152 | protected function parseEntries(array $entries) |
155 | { | 153 | { |
156 | $i = 1; | 154 | $i = 1; |
157 | $entryToBeFlushed = []; | 155 | $entryToBeFlushed = []; |
@@ -199,8 +197,6 @@ abstract class BrowserImport extends AbstractImport | |||
199 | * | 197 | * |
200 | * Faster parse entries for Producer. | 198 | * Faster parse entries for Producer. |
201 | * We don't care to make check at this time. They'll be done by the consumer. | 199 | * We don't care to make check at this time. They'll be done by the consumer. |
202 | * | ||
203 | * @param array $entries | ||
204 | */ | 200 | */ |
205 | protected function parseEntriesForProducer(array $entries) | 201 | protected function parseEntriesForProducer(array $entries) |
206 | { | 202 | { |