1 | <?php |
||
9 | class OpenGraphExtension extends \Twig_Extension |
||
10 | { |
||
11 | /** @var OpenGraphRendererInterface */ |
||
12 | private $renderer; |
||
13 | |||
14 | |||
15 | /** |
||
16 | * Constructor |
||
17 | * |
||
18 | * @param OpenGraphRendererInterface $renderer |
||
19 | */ |
||
20 | public function __construct(OpenGraphRendererInterface $renderer) |
||
24 | |||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | */ |
||
28 | public function getFunctions() |
||
36 | |||
37 | /** |
||
38 | * Render namespaces |
||
39 | * |
||
40 | * @param OpenGraphInterface $graph |
||
41 | * @param bool $withTag |
||
42 | * @return string |
||
43 | */ |
||
44 | public function renderNamespaceFunction(OpenGraphInterface $graph, $withTag = true) |
||
48 | |||
49 | /** |
||
50 | * Render graph |
||
51 | * |
||
52 | * @param OpenGraphInterface $graph |
||
53 | * @param string $separator |
||
54 | * @return string |
||
55 | */ |
||
56 | public function renderGraphFunction(OpenGraphInterface $graph, $separator = PHP_EOL) |
||
60 | |||
61 | /** |
||
62 | * Render graph tag |
||
63 | * |
||
64 | * @param OpenGraphTagInterface $tag |
||
65 | * @return string |
||
66 | */ |
||
67 | public function renderTagFunction(OpenGraphTagInterface $tag) |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | public function getName() |
||
79 | } |
||
80 |