-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEngine.hh
More file actions
108 lines (93 loc) · 2.36 KB
/
Copy pathEngine.hh
File metadata and controls
108 lines (93 loc) · 2.36 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?hh // strict
/**
* @copyright 2010-2015, The Titon Project
* @license http://opensource.org/licenses/bsd-license.php
* @link http://titon.io
*/
namespace Titon\View;
use Titon\View\Engine\WrapperList;
/**
* Interface for the rendering engine.
*
* @package Titon\View
*/
interface Engine {
/**
* Return a variable by key.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function data(string $key, mixed $default = null): mixed;
/**
* Return the currently parsed template.
*
* @return string
*/
public function getContent(): string;
/**
* Return the layout.
*
* @return string
*/
public function getLayout(): string;
/**
* Return the list of wrappers.
*
* @return \Titon\View\WrapperList
*/
public function getWrappers(): WrapperList;
/**
* Return the view instance.
*
* @return $this
*/
public function getView(): ?View;
/**
* Render a template partial (nested templates) that is included within the current template.
* Can optionally pass in a list of variables that is accessible in the template.
*
* @param string $partial
* @param \Titon\View\DataMap $variables
* @return string
*/
public function open(string $partial, DataMap $variables = Map {}): string;
/**
* Render a template at the defined absolute path.
* Can optionally pass in a list of variables that is accessible in the template.
*
* @param string $path
* @param \Titon\View\DataMap $variables
* @return string
*/
public function render(string $path, DataMap $variables = Map {}): string;
/**
* Set the content.
*
* @param string $content
* @return $this
*/
public function setContent(string $content): this;
/**
* Set the parent view manager.
*
* @param \Titon\View\View $view
* @return $this
*/
public function setView(View $view): this;
/**
* Set the layout to use.
*
* @param string $name
* @return $this
*/
public function useLayout(string $name): this;
/**
* Set the wrappers to use.
*
* @param string $names
* @return $this
*/
public function wrapWith(/* HH_FIXME[4033]: variadic + strict */ ...$names): this;
}