Conditions | 3 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
51 | public function getTemplateData(string $partialPath, array $data = []): bool|string |
||
52 | { |
||
53 | $viewPathFile = $this->execConfig('telegram-git-notifier.view.path') . '/' |
||
54 | . str_replace('.', '/', $partialPath) . '.php'; |
||
55 | |||
56 | if (!file_exists($viewPathFile)) { |
||
57 | return ''; |
||
58 | } |
||
59 | |||
60 | $content = ''; |
||
61 | ob_start(); |
||
62 | |||
63 | try { |
||
64 | extract($data, EXTR_SKIP); |
||
65 | require_once $viewPathFile; |
||
66 | $content = ob_get_clean(); |
||
67 | } catch (EntryNotFoundException|InvalidViewTemplateException|Throwable $e) { |
||
68 | ob_end_clean(); |
||
69 | error_log($e->getMessage()); |
||
70 | } |
||
71 | |||
72 | return $content; |
||
73 | } |
||
75 |