| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 60% |
| 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 | 2 | public function getContent($view): string |
|
| 19 | { |
||
| 20 | 2 | $file = getcwd() . '/' . $this->config['template_dir'] . "/$view.html"; |
|
| 21 | |||
| 22 | 2 | if (!file_exists($file)) { |
|
| 23 | throw new \Exception("$file template not found"); |
||
| 24 | } |
||
| 25 | |||
| 26 | 2 | return $this->removeTags(file_get_contents($file)); |
|
| 27 | } |
||
| 28 | |||
| 29 | 2 | public function removeTags($content) |
|
| 32 | } |
||
| 33 | } |
||
| 34 |