{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Http\/ViewTrait.php"
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Http\/ViewTrait.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Framework\\Http;\n\n\/\/ @responsibility: View-Rendering für Controller\n\ntrait ViewTrait\n{\n \/**\n * Render a full view template.\n *\n * @param array<string, mixed> $data\n *\/\n protected function view(string $name, array $data = []): void\n {\n $data['csrfField'] = $this->csrfField();\n $data['csrfToken'] = $this->csrfToken();\n $data['flashSuccess'] = $this->consumeFlash('success');\n $data['flashError'] = $this->consumeFlash('error');\n $__viewPath = VIEW_PATH . '\/' . str_replace('.', '\/', $name) . '.php';\n extract($data);\n\n if (file_exists($__viewPath)) {\n require $__viewPath;\n } else {\n throw new \\Exception(\"View not found: {$name}\");\n }\n }\n\n \/**\n * Render a partial template (for HTMX responses).\n *\n * @param array<string, mixed> $data\n *\/\n protected function partial(string $name, array $data = []): void\n {\n $data['csrfField'] = $this->csrfField();\n $data['csrfToken'] = $this->csrfToken();\n extract($data);\n\n $paths = [\n VIEW_PATH . '\/' . str_replace('.', '\/', $name) . '.php',\n VIEW_PATH . '\/partials\/' . str_replace('.', '\/', $name) . '.php',\n ];\n\n foreach ($paths as $file) {\n if (file_exists($file)) {\n require $file;\n\n return;\n }\n }\n\n throw new \\Exception(\"Partial not found: {$name}\");\n }\n\n \/**\n * Consume flash message from session.\n *\/\n protected function consumeFlash(string $key): ?string\n {\n $value = $_SESSION[$key] ?? null;\n if ($value !== null) {\n unset($_SESSION[$key]);\n }\n\n return $value;\n }\n\n \/**\n * Set flash message in session.\n *\/\n protected function flash(string $key, string $message): void\n {\n $_SESSION[$key] = $message;\n }\n}\n",
"numLines": 80,
"startLine": 1,
"totalLines": 80
}
}
}