| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public static function generate(string $name, array $params): string |
||
| 29 | { |
||
| 30 | $di = Di::getDefault(); |
||
| 31 | $view = $di->getView(); |
||
| 32 | $filesystem = $di->get('filesystem', ['local']); |
||
| 33 | |||
| 34 | //get the teamplate |
||
| 35 | $template = EmailTemplates::getByName($name); |
||
| 36 | $file = $template->name . '.volt'; |
||
| 37 | |||
| 38 | //write file |
||
| 39 | $filesystem->put('/view/'.$file, $template->template); |
||
| 40 | |||
| 41 | //rendre and return content |
||
| 42 | return $view->render($template->name, $params); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |