+
+ if (!empty($content['all_headers']) && $this->storeArticleHeaders) {
+ $entry->setHeaders($content['all_headers']);
+ }
+
+ if (!empty($content['date'])) {
+ $this->updatePublishedAt($entry, $content['date']);
+ }
+
+ if (!empty($content['language'])) {
+ $this->updateLanguage($entry, $content['language']);
+ }
+
+ if (!empty($content['open_graph']['og_image'])) {
+ $this->updatePreviewPicture($entry, $content['open_graph']['og_image']);
+ }
+
+ // if content is an image, define it as a preview too
+ if (!empty($content['content_type']) && \in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
+ $this->updatePreviewPicture($entry, $content['url']);
+ }
+
+ if (!empty($content['content_type'])) {
+ $entry->setMimetype($content['content_type']);
+ }
+
+ try {
+ $this->tagger->tag($entry);
+ } catch (\Exception $e) {
+ $this->logger->error('Error while trying to automatically tag an entry.', [
+ 'entry_url' => $content['url'],
+ 'error_msg' => $e->getMessage(),
+ ]);
+ }
+ }
+
+ /**
+ * Validate that the given content has at least a title, an html and a url.
+ *
+ * @param array $content
+ *
+ * @return bool true if valid otherwise false
+ */
+ private function validateContent(array $content)
+ {
+ return !empty($content['title']) && !empty($content['html']) && !empty($content['url']);