Conditions | 4 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function render(string $view, array $params = [], array $configs = []): string |
||
35 | { |
||
36 | $fs = Di::get(FileSystem::class); |
||
37 | |||
38 | $filePath = modules_dir() . DS . current_module() . DS . 'Views' . DS . $view . '.php'; |
||
39 | |||
40 | if (!$fs->exists($filePath)) { |
||
41 | $filePath = base_dir() . DS . 'base' . DS . 'views' . DS . $view . '.php'; |
||
42 | if (!$fs->exists($filePath)) { |
||
43 | throw ViewException::fileNotFound($view); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | ob_start(); |
||
48 | ob_implicit_flush(0); |
||
49 | |||
50 | if (!empty($params)) { |
||
51 | extract($params, EXTR_OVERWRITE); |
||
52 | } |
||
53 | |||
54 | require $filePath; |
||
55 | |||
56 | return ob_get_clean(); |
||
57 | } |
||
59 | } |