+ // if content is an image define as a preview too
+ if (!empty($content['content_type']) && in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
+ $entry->setPreviewPicture($content['url']);
+ }
+
+ 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']);