{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Http\/ResponseTrait.php"
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Http\/ResponseTrait.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Framework\\Http;\n\n\/\/ @responsibility: HTTP-Response-Output für Framework-Layer\n\ntrait ResponseTrait\n{\n protected function json(mixed $data, int $status = 200): void\n {\n http_response_code($status);\n header('Content-Type: application\/json');\n echo json_encode($data, JSON_UNESCAPED_UNICODE);\n }\n\n protected function jsonError(string $message, int $status = 500): void\n {\n $this->json(['success' => false, 'error' => $message], $status);\n }\n\n protected function redirect(string $url, int $status = 302): never\n {\n http_response_code($status);\n header(\"Location: {$url}\");\n exit;\n }\n\n protected function text(string $content, int $status = 200): void\n {\n http_response_code($status);\n header('Content-Type: text\/plain; charset=utf-8');\n print $content;\n }\n\n protected function html(string $content, int $status = 200): void\n {\n http_response_code($status);\n header('Content-Type: text\/html; charset=utf-8');\n print $content;\n }\n\n protected function download(string $content, string $filename, string $contentType = 'application\/octet-stream'): void\n {\n header('Content-Type: ' . $contentType . '; charset=utf-8');\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Content-Length: ' . strlen($content));\n print $content;\n }\n\n \/**\n * Return 404 Not Found response and exit.\n *\/\n protected function notFound(string $message = 'Nicht gefunden'): never\n {\n $accept = $_SERVER['HTTP_ACCEPT'] ?? '';\n $contentType = $_SERVER['CONTENT_TYPE'] ?? '';\n $isJson = str_contains($accept, 'application\/json') || str_contains($contentType, 'application\/json');\n\n if ($isJson) {\n $this->json(['error' => $message], 404);\n } else {\n $this->text(\"404 - {$message}\", 404);\n }\n exit;\n }\n}\n",
"numLines": 69,
"startLine": 1,
"totalLines": 69
}
}
}