| @@ 67-82 (lines=16) @@ | ||
| 64 | * |
|
| 65 | * @return string |
|
| 66 | */ |
|
| 67 | public function renderOpenGraphTags(Content $content) |
|
| 68 | { |
|
| 69 | try { |
|
| 70 | return $this->tagRenderer->render( |
|
| 71 | $this->getOpenGraphTags($content) |
|
| 72 | ); |
|
| 73 | } catch (Exception $e) { |
|
| 74 | if ($this->throwExceptions || !$this->logger instanceof LoggerInterface) { |
|
| 75 | throw $e; |
|
| 76 | } |
|
| 77 | ||
| 78 | $this->logger->error($e->getMessage()); |
|
| 79 | } |
|
| 80 | ||
| 81 | return ''; |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * Returns Open Graph tags for provided content. |
|
| @@ 91-104 (lines=14) @@ | ||
| 88 | * |
|
| 89 | * @return \Netgen\Bundle\OpenGraphBundle\MetaTag\Item[] |
|
| 90 | */ |
|
| 91 | public function getOpenGraphTags(Content $content) |
|
| 92 | { |
|
| 93 | try { |
|
| 94 | return $this->tagCollector->collect($content); |
|
| 95 | } catch (Exception $e) { |
|
| 96 | if ($this->throwExceptions || !$this->logger instanceof LoggerInterface) { |
|
| 97 | throw $e; |
|
| 98 | } |
|
| 99 | ||
| 100 | $this->logger->error($e->getMessage()); |
|
| 101 | } |
|
| 102 | ||
| 103 | return array(); |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||