| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 2 | public function render(string $view, array $data = []): string |
|
| 29 | { |
||
| 30 | 2 | try { |
|
| 31 | 2 | $content = $this->handle($this->getContent($view, $this->config)); |
|
| 32 | 2 | } catch (Exception $e) { |
|
| 33 | 2 | die($e->getMessage()); |
|
| 34 | } |
||
| 35 | |||
| 36 | 2 | $this->data = array_merge($this->data, $data); |
|
| 37 | |||
| 38 | $fname = getcwd() . '/' . $this->config['cache_dir'] . '/' . $view . '.phtml'; |
||
| 39 | 2 | ||
| 40 | $file = new File($fname); |
||
| 41 | 2 | ||
| 42 | 2 | if ($this->config['environment'] == 'production') { |
|
| 43 | 2 | $file->open(); |
|
| 44 | 2 | } elseif ($this->config['environment'] == 'development') { |
|
| 45 | 2 | $this->setCache($file, $content); |
|
| 46 | 2 | } |
|
| 47 | |||
| 48 | 2 | $content = $file->read($this->data); |
|
| 49 | |||
| 50 | $file->close(); |
||
| 51 | |||
| 52 | return $content; |
||
| 53 | } |
||
| 78 |