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