1 | <?php |
||
21 | class Twig implements TemplateInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var array the complete phile config |
||
25 | */ |
||
26 | protected $settings; |
||
27 | |||
28 | /** |
||
29 | * @var array the config for twig |
||
30 | */ |
||
31 | protected $config; |
||
32 | |||
33 | /** |
||
34 | * @var Page the page model |
||
35 | */ |
||
36 | protected $page; |
||
37 | |||
38 | /** |
||
39 | * the constructor |
||
40 | * |
||
41 | * @param array $config the configuration |
||
42 | */ |
||
43 | 26 | public function __construct($config = []) |
|
48 | |||
49 | /** |
||
50 | * method to set the current page |
||
51 | * |
||
52 | * @param Page $page the page model |
||
53 | * |
||
54 | * @return mixed|void |
||
55 | */ |
||
56 | 2 | public function setCurrentPage(Page $page) |
|
60 | |||
61 | /** |
||
62 | * method to render the page/template |
||
63 | * |
||
64 | * @return mixed|string |
||
65 | */ |
||
66 | 2 | public function render() |
|
76 | |||
77 | /** |
||
78 | * wrapper to call the render engine |
||
79 | * |
||
80 | * @param $engine |
||
81 | * @param $vars |
||
82 | * @return mixed |
||
83 | */ |
||
84 | 2 | protected function doRender($engine, $vars) |
|
93 | |||
94 | /** |
||
95 | * get template engine |
||
96 | * |
||
97 | * @return \Twig_Environment |
||
98 | */ |
||
99 | 2 | protected function getEngine() |
|
110 | |||
111 | /** |
||
112 | * get template file name |
||
113 | * |
||
114 | * @return string |
||
115 | * @throws \RuntimeException |
||
116 | */ |
||
117 | 2 | protected function getTemplateFileName() |
|
135 | |||
136 | /** |
||
137 | * get file path to (sub-path) in theme-path |
||
138 | * |
||
139 | * @param string $sub |
||
140 | * @return string |
||
141 | */ |
||
142 | 2 | protected function getTemplatePath($sub = '') |
|
150 | |||
151 | /** |
||
152 | * get template vars |
||
153 | * |
||
154 | * @return array|mixed |
||
155 | * @throws \Exception |
||
156 | */ |
||
157 | 2 | protected function getTemplateVars() |
|
174 | } |
||
175 |