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