-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTemplateEngineInterface.php
executable file
·65 lines (58 loc) · 1.62 KB
/
TemplateEngineInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Webiny Framework (http://www.webiny.com/framework)
*
* @copyright Copyright Webiny LTD
*/
namespace Webiny\Component\TemplateEngine;
/**
* This is the interface that every template engine driver must implement.
*
* @package Webiny\Component\TemplateEngine
*/
interface TemplateEngineInterface
{
/**
* Fetch the template from the given location, parse it and return the output.
*
* @param string $template Path to the template.
* @param array $parameters A list of parameters to pass to the template.
*
* @return string Parsed template.
*/
public function fetch($template, $parameters = []);
/**
* Fetch the template from the given location, parse it and output the result to the browser.
*
* @param string $template Path to the template.
* @param array $parameters A list of parameters to pass to the template.
*
* @return void
*/
public function render($template, $parameters = []);
/**
* Assign a variable and its value into the template engine.
*
* @param string $var Variable name.
* @param mixed $value Variable value.
*
* @return void
*/
public function assign($var, $value);
/**
* Root dir where the templates are stored.
*
* @param string $path Absolute path to the directory that holds the templates.
*
* @return void
*/
public function setTemplateDir($path);
/**
* Register a plugin for the template engine.
*
* @param Plugin $plugin
*
* @return void
*/
public function registerPlugin(Plugin $plugin);
}