Conditions | 4 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4.1574 |
Changes | 0 |
1 | <?php |
||
44 | 2 | public function render(string $view, array $data = []): string |
|
45 | { |
||
46 | try { |
||
47 | 2 | $content = $this->handle(Content::getContent($view, Tag::getConfig())); |
|
48 | } catch (Exception $e) { |
||
49 | return $e->getMessage(); |
||
50 | } |
||
51 | |||
52 | 2 | $this->data = array_merge($this->data, $data); |
|
53 | |||
54 | 2 | $fname = getcwd() . '/' . Tag::getConfig()['cache_dir'] . '/' . $view . '.phtml'; |
|
55 | |||
56 | 2 | $file = new File($fname); |
|
57 | |||
58 | 2 | if (Tag::getConfig()['environment'] == 'production') { |
|
59 | $file->open(); |
||
60 | 2 | } elseif (Tag::getConfig()['environment'] == 'development') { |
|
61 | 2 | $this->setCache($file, $content); |
|
62 | } |
||
63 | |||
64 | 2 | $content = $file->read($this->data); |
|
65 | |||
66 | 2 | $file->close(); |
|
67 | |||
68 | 2 | return $content; |
|
69 | } |
||
112 |