aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper/ContentProxy.php
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2015-12-06 14:31:26 +0100
committerJeremy Benoist <j0k3r@users.noreply.github.com>2015-12-06 14:31:26 +0100
commita7f1921f7db312b5def3839393357f443dcbb52c (patch)
tree0522e03891433e9fdc9eb64d52b2d9651aadf1f7 /src/Wallabag/CoreBundle/Helper/ContentProxy.php
parent2e15e30bf0e634bbbc3a9678904953d015490ed2 (diff)
parent752b90d1f2e279d3662d5431b09c7587df2937ca (diff)
downloadwallabag-a7f1921f7db312b5def3839393357f443dcbb52c.tar.gz
wallabag-a7f1921f7db312b5def3839393357f443dcbb52c.tar.zst
wallabag-a7f1921f7db312b5def3839393357f443dcbb52c.zip
Merge pull request #1478 from K-Phoen/rule-based-tags
Rule based tags
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/ContentProxy.php')
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index 7fb41393..3d585e61 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -3,6 +3,7 @@
3namespace Wallabag\CoreBundle\Helper; 3namespace Wallabag\CoreBundle\Helper;
4 4
5use Graby\Graby; 5use Graby\Graby;
6use Psr\Log\LoggerInterface as Logger;
6use Wallabag\CoreBundle\Entity\Entry; 7use Wallabag\CoreBundle\Entity\Entry;
7use Wallabag\CoreBundle\Tools\Utils; 8use Wallabag\CoreBundle\Tools\Utils;
8 9
@@ -13,10 +14,14 @@ use Wallabag\CoreBundle\Tools\Utils;
13class ContentProxy 14class ContentProxy
14{ 15{
15 protected $graby; 16 protected $graby;
17 protected $tagger;
18 protected $logger;
16 19
17 public function __construct(Graby $graby) 20 public function __construct(Graby $graby, RuleBasedTagger $tagger, Logger $logger)
18 { 21 {
19 $this->graby = $graby; 22 $this->graby = $graby;
23 $this->tagger = $tagger;
24 $this->logger = $logger;
20 } 25 }
21 26
22 /** 27 /**
@@ -59,6 +64,15 @@ class ContentProxy
59 $entry->setPreviewPicture($content['open_graph']['og_image']); 64 $entry->setPreviewPicture($content['open_graph']['og_image']);
60 } 65 }
61 66
67 try {
68 $this->tagger->tag($entry);
69 } catch (\Exception $e) {
70 $this->logger->error('Error while trying to automatically tag an entry.', array(
71 'entry_url' => $url,
72 'error_msg' => $e->getMessage(),
73 ));
74 }
75
62 return $entry; 76 return $entry;
63 } 77 }
64} 78}