Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
5 | trait ParseTpl |
||
6 | { |
||
7 | protected $config = array(); |
||
8 | protected $data = array( |
||
9 | '__version' => '1.0.0' |
||
10 | ); |
||
11 | protected $view = ''; |
||
12 | |||
13 | public function config(array $config) |
||
14 | { |
||
15 | $this->config = $config; |
||
16 | } |
||
17 | |||
18 | public function getContent($view): string |
||
19 | { |
||
20 | $file = getcwd() . '/' . $this->config['template_dir'] . "/$view.html"; |
||
21 | |||
22 | if (!file_exists($file)) { |
||
23 | throw new \Exception("$file template not found"); |
||
24 | } |
||
25 | |||
26 | return $this->removeTags(file_get_contents($file)); |
||
27 | } |
||
28 | |||
29 | public function removeTags($content) |
||
32 | } |
||
33 | } |
||
34 |