{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Http\/HtmxResponseTrait.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Framework\\Http;\n\n\/\/ @responsibility: HTMX-Response-Helpers für HTTP-Layer\n\ntrait HtmxResponseTrait\n{\n \/**\n * Output an HTMX-compatible alert message.\n *\/\n protected function htmxAlert(string $type, string $message): void\n {\n header('HX-Retarget: #htmx-messages');\n header('HX-Reswap: beforeend');\n\n $escapedMessage = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');\n $id = 'alert-' . uniqid();\n echo \"<div id=\\\"{$id}\\\" class=\\\"alert alert--{$type}\\\">{$escapedMessage}<\/div>\";\n echo \"<script>setTimeout(() => document.getElementById('{$id}')?.remove(), 5000)<\/script>\";\n }\n\n protected function htmxSuccess(string $message): void\n {\n $this->htmxAlert('success', $message);\n }\n\n protected function htmxError(string $message): void\n {\n $this->htmxAlert('error', $message);\n }\n\n protected function isHtmxRequest(): bool\n {\n return isset($_SERVER['HTTP_HX_REQUEST']);\n }\n\n protected function htmxRedirect(string $url): void\n {\n header('HX-Redirect: ' . $url);\n $this->text('OK');\n }\n}\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Http\/HtmxResponseTrait.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Framework\\Http;\n\n\/\/ @responsibility: HTMX-Response-Helpers für HTTP-Layer\n\ntrait HtmxResponseTrait\n{\n \/**\n * Output an HTMX-compatible alert message.\n *\/\n protected function htmxAlert(string $type, string $message): void\n {\n header('HX-Retarget: #htmx-messages');\n header('HX-Reswap: beforeend');\n\n $escapedMessage = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');\n $id = 'alert-' . uniqid();\n echo \"<div id=\\\"{$id}\\\" class=\\\"alert alert--{$type}\\\">{$escapedMessage}<\/div>\";\n echo \"<script>setTimeout(() => document.getElementById('{$id}')?.remove(), 5000)<\/script>\";\n }\n\n protected function htmxSuccess(string $message): void\n {\n $this->htmxAlert('success', $message);\n }\n\n protected function htmxError(string $message): void\n {\n $this->htmxAlert('error', $message);\n }\n\n protected function isHtmxRequest(): bool\n {\n return isset($_SERVER['HTTP_HX_REQUEST']);\n }\n\n protected function htmxRedirect(string $url): void\n {\n header('HX-Redirect: ' . $url);\n $this->text('OK');\n }\n}\n",
"structuredPatch": [],
"originalFile": null
}
}