Initial Kaffeekasse SaaS restart

This commit is contained in:
2026-06-15 17:13:38 +02:00
commit b08eb93547
54 changed files with 4617 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Core;
final class View
{
public function __construct(
private readonly string $rootPath,
private readonly array $shared = []
) {
}
public function render(string $template, array $data = []): void
{
$templateFile = $this->rootPath . '/resources/views/' . $template . '.php';
if (!is_file($templateFile)) {
http_response_code(500);
echo 'View not found: ' . htmlspecialchars($template, ENT_QUOTES, 'UTF-8');
return;
}
$shared = $this->shared;
extract($shared, EXTR_SKIP);
extract($data, EXTR_SKIP);
require $templateFile;
}
}