1 | <?php |
||
12 | class SmartyEngine extends Smarty implements TemplateEngine |
||
13 | { |
||
14 | /** |
||
15 | * Create the Smarty engine, set the template- and cache directory; and add the plugin directory. |
||
16 | * |
||
17 | * @param string $templateDir |
||
18 | * @param string $cacheDir |
||
19 | */ |
||
20 | public function __construct(?string $templateDir = './src', ?string $cacheDir = './.cache') { |
||
21 | parent::__construct(); |
||
22 | |||
23 | $this->addTemplateDir($templateDir); |
||
24 | $this->setCompileDir($cacheDir); |
||
25 | $this->addPluginsDir([__DIR__]); |
||
26 | |||
27 | $this->caching = false; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | */ |
||
33 | public function renderTemplate(SplFileInfo $template) { |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | public function addTemplateVariables(array $variables) { |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function clearTemplateVariables() { |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | public function addTemplateVariable($name, $value) { |
||
65 | |||
66 | /** |
||
67 | * Check whether a template variable is set |
||
68 | * |
||
69 | * @param string $name |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function hasTemplateVariable(string $name) : bool { |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | public function clearTemplateVariable($variable) { |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function getTemplateExtension() { |
||
92 | } |
||
93 |