1 | <?php |
||
30 | class QuoteTwigExtension extends AbstractTwigExtension { |
||
31 | |||
32 | use QuoteManagerTrait; |
||
33 | |||
34 | /** |
||
35 | * Service name. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | const SERVICE_NAME = "webeweb.core.twig.extension.quote"; |
||
40 | |||
41 | /** |
||
42 | * Constructor. |
||
43 | * |
||
44 | * @param Environment $twigEnvironment The Twig environment. |
||
45 | * @param QuoteManager $quoteManager The quote manager. |
||
46 | */ |
||
47 | public function __construct(Environment $twigEnvironment, QuoteManager $quoteManager) { |
||
51 | |||
52 | /** |
||
53 | * Get the Twig functions. |
||
54 | * |
||
55 | * @return TwigFunction[] Returns the Twig functions. |
||
56 | */ |
||
57 | public function getFunctions() { |
||
64 | |||
65 | /** |
||
66 | * Get the quote provider. |
||
67 | * |
||
68 | * @param string|null $domain The domain. |
||
69 | * @return QuoteProviderInterface|null Returns the quote provider. |
||
70 | */ |
||
71 | protected function getQuoteProvider($domain = null) { |
||
83 | |||
84 | /** |
||
85 | * Displays a quote author. |
||
86 | * |
||
87 | * @param string $domain The domain. |
||
88 | * @return string Returns the quote author. |
||
89 | * @throws Exception Throws an exception if an error occurs. |
||
90 | */ |
||
91 | public function quoteAuthorFunction($domain = null) { |
||
100 | |||
101 | /** |
||
102 | * Displays a quote content. |
||
103 | * |
||
104 | * @param string $domain The domain. |
||
105 | * @return string Returns the quote content. |
||
106 | * @throws Exception Throws an exception if an error occurs. |
||
107 | */ |
||
108 | public function quoteContentFunction($domain = null) { |
||
117 | |||
118 | /** |
||
119 | * Get the quote. |
||
120 | * |
||
121 | * @param string|null $domain The domain. |
||
122 | * @return QuoteInterface|null Returns the quote. |
||
123 | * @throws Exception Throws an exception if an error occurs. |
||
124 | */ |
||
125 | public function quoteFunction($domain = null) { |
||
134 | } |
||
135 |