{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ProtokollController.php"
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ProtokollController.php",
"content": "<?php\n\nnamespace Controller;\n\nuse Domain\\ValueObject\\Pagination;\nuse Framework\\Controller;\nuse Infrastructure\\Persistence\\KiProtokollRepository;\n\nclass ProtokollController extends Controller\n{\n private KiProtokollRepository $protokollRepo;\n\n public function __construct(?KiProtokollRepository $protokollRepo = null)\n {\n $this->protokollRepo = $protokollRepo ?? new KiProtokollRepository();\n }\n\n public function index(): void\n {\n $pagination = Pagination::fromRequest(50);\n\n $search = $this->getString('search');\n $status = $this->getString('status');\n $model = $this->getString('model');\n\n $searchVal = $search !== '' ? $search : null;\n $statusVal = $status !== '' ? $status : null;\n $modelVal = $model !== '' ? $model : null;\n\n $totalCount = $this->protokollRepo->countFiltered($searchVal, $statusVal, $modelVal);\n $pagination = $pagination->withTotal($totalCount);\n\n $entries = $this->protokollRepo->findPaginated(\n $searchVal,\n $statusVal,\n $modelVal,\n $pagination->limit,\n $pagination->offset\n );\n\n $this->view('protokoll.index', [\n 'title' => 'KI-Protokoll',\n 'stats' => $this->protokollRepo->getStatistics(),\n 'entries' => $entries,\n 'models' => $this->protokollRepo->getDistinctModels(),\n 'currentSearch' => $search,\n 'currentStatus' => $status,\n 'currentModel' => $model,\n 'currentPage' => $pagination->page,\n 'totalCount' => $pagination->totalCount,\n 'totalPages' => $pagination->totalPages(),\n ]);\n }\n\n public function show(string $id): void\n {\n $entry = $this->protokollRepo->findById((int) $id);\n if ($entry === null) {\n $this->notFound('Protokoll-Eintrag nicht gefunden');\n }\n\n $entry['request_formatted'] = $this->formatJson($entry['request']);\n $entry['response_formatted'] = $this->formatJson($entry['response']);\n\n $prevId = $this->protokollRepo->findPreviousId((int) $id);\n $nextId = $this->protokollRepo->findNextId((int) $id);\n\n $this->view('protokoll.show', [\n 'title' => 'Protokoll #' . $id,\n 'entry' => $entry,\n 'prevEntry' => $prevId !== null ? ['id' => $prevId] : false,\n 'nextEntry' => $nextId !== null ? ['id' => $nextId] : false,\n ]);\n }\n\n private function formatJson(?string $json): string\n {\n if ($json === null || $json === '') {\n return '-';\n }\n\n $decoded = json_decode($json, true);\n if ($decoded === null) {\n return htmlspecialchars($json);\n }\n\n $formatted = json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);\n\n return $formatted !== false ? $formatted : htmlspecialchars($json);\n }\n}\n",
"numLines": 92,
"startLine": 1,
"totalLines": 92
}
}
}