{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/DocsController.php",
"oldString": "use Domain\\Repository\\DokumentationRepositoryInterface;\nuse Domain\\Repository\\TaskRepositoryInterface;\nuse Framework\\Controller;\nuse Infrastructure\\Persistence\\DokumentationRepository;\nuse Infrastructure\\Persistence\\KiProtokollRepository;\nuse Infrastructure\\Persistence\\TaskAssignmentRepository;\nuse Infrastructure\\Persistence\\TaskCommentRepository;\nuse Infrastructure\\Persistence\\TaskRepository;\nuse Infrastructure\\Persistence\\TaskResultRepository;\n\nclass DocsController extends Controller\n{\n private DokumentationRepositoryInterface $docsRepo;\n private KiProtokollRepository $protokollRepo;\n private TaskRepositoryInterface $taskRepo;\n private TaskAssignmentRepository $assignmentRepo;\n private TaskResultRepository $resultRepo;\n private TaskCommentRepository $commentRepo;\n\n public function __construct(\n DokumentationRepository $docsRepo,\n KiProtokollRepository $protokollRepo,\n TaskRepository $taskRepo,\n TaskAssignmentRepository $assignmentRepo,\n TaskResultRepository $resultRepo,\n TaskCommentRepository $commentRepo\n )",
"newString": "use Domain\\Repository\\DokumentationRepositoryInterface;\nuse Domain\\Repository\\KiProtokollRepositoryInterface;\nuse Domain\\Repository\\TaskAssignmentRepositoryInterface;\nuse Domain\\Repository\\TaskCommentRepositoryInterface;\nuse Domain\\Repository\\TaskRepositoryInterface;\nuse Domain\\Repository\\TaskResultRepositoryInterface;\nuse Framework\\Controller;\n\nclass DocsController extends Controller\n{\n private DokumentationRepositoryInterface $docsRepo;\n private KiProtokollRepositoryInterface $protokollRepo;\n private TaskRepositoryInterface $taskRepo;\n private TaskAssignmentRepositoryInterface $assignmentRepo;\n private TaskResultRepositoryInterface $resultRepo;\n private TaskCommentRepositoryInterface $commentRepo;\n\n public function __construct(\n DokumentationRepositoryInterface $docsRepo,\n KiProtokollRepositoryInterface $protokollRepo,\n TaskRepositoryInterface $taskRepo,\n TaskAssignmentRepositoryInterface $assignmentRepo,\n TaskResultRepositoryInterface $resultRepo,\n TaskCommentRepositoryInterface $commentRepo\n )",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Controller;\n\n\/\/ @responsibility: HTTP-Endpunkte für Dokumentation und Task-Ansichten\n\nuse Domain\\Repository\\DokumentationRepositoryInterface;\nuse Domain\\Repository\\TaskRepositoryInterface;\nuse Framework\\Controller;\nuse Infrastructure\\Persistence\\DokumentationRepository;\nuse Infrastructure\\Persistence\\KiProtokollRepository;\nuse Infrastructure\\Persistence\\TaskAssignmentRepository;\nuse Infrastructure\\Persistence\\TaskCommentRepository;\nuse Infrastructure\\Persistence\\TaskRepository;\nuse Infrastructure\\Persistence\\TaskResultRepository;\n\nclass DocsController extends Controller\n{\n private DokumentationRepositoryInterface $docsRepo;\n private KiProtokollRepository $protokollRepo;\n private TaskRepositoryInterface $taskRepo;\n private TaskAssignmentRepository $assignmentRepo;\n private TaskResultRepository $resultRepo;\n private TaskCommentRepository $commentRepo;\n\n public function __construct(\n DokumentationRepository $docsRepo,\n KiProtokollRepository $protokollRepo,\n TaskRepository $taskRepo,\n TaskAssignmentRepository $assignmentRepo,\n TaskResultRepository $resultRepo,\n TaskCommentRepository $commentRepo\n ) {\n $this->docsRepo = $docsRepo;\n $this->protokollRepo = $protokollRepo;\n $this->taskRepo = $taskRepo;\n $this->assignmentRepo = $assignmentRepo;\n $this->resultRepo = $resultRepo;\n $this->commentRepo = $commentRepo;\n }\n\n public function index(): void\n {\n $this->view('docs.index', [\n 'title' => 'Dokumentation',\n 'hierarchy' => $this->docsRepo->getHierarchy(),\n ]);\n }\n\n public function redirectBySlug(string $slug): void\n {\n $doc = $this->docsRepo->findDocBySlug($slug);\n\n if ($doc === null) {\n $this->notFound('Dokumentation nicht gefunden: ' . $slug);\n }\n\n header('Location: \/docs' . $doc['path'], true, 301);\n exit;\n }\n\n public function show(string $path): void\n {\n $path = '\/' . ltrim($path, '\/');\n $doc = $this->docsRepo->findByPath($path);\n\n if ($doc === null) {\n $this->notFound('Dokumentation nicht gefunden: ' . $path);\n }\n\n $data = [\n 'title' => $doc['title'],\n 'doc' => $doc,\n 'breadcrumb' => $this->docsRepo->getBreadcrumb((int) $doc['id']),\n 'children' => $this->docsRepo->findChildren((int) $doc['id']),\n 'siblings' => $this->docsRepo->getSiblings((int) $doc['id']),\n ];\n\n \/\/ Modul-spezifische Daten laden\n if ($doc['slug'] === 'ki-protokoll') {\n $data['entries'] = $this->protokollRepo->findLatest(20);\n }\n\n $this->view('docs.show', $data);\n }\n\n public function tasksIndex(): void\n {\n $this->view('tasks.index', [\n 'title' => 'Tasks',\n 'stats' => $this->taskRepo->getStatistics(),\n 'tasks' => array_map(fn ($t) => $t->toArray(), $this->taskRepo->findAll([], 50, 0)),\n ]);\n }\n\n public function tasksNew(): void\n {\n $this->view('tasks.new', [\n 'title' => 'Neuer Task',\n ]);\n }\n\n public function tasksEdit(string $id): void\n {\n $task = $this->taskRepo->findById((int) $id);\n\n if ($task === null) {\n $this->notFound('Task nicht gefunden');\n }\n\n $this->view('tasks.edit', [\n 'title' => 'Task bearbeiten',\n 'task' => $task->toArray(),\n ]);\n }\n\n public function taskShow(string $id): void\n {\n $task = $this->taskRepo->findById((int) $id);\n\n if ($task === null) {\n $this->notFound('Task nicht gefunden');\n }\n\n $this->view('tasks.show', [\n 'title' => 'Task #' . $id,\n 'task' => $task->toArray(),\n 'assignments' => array_map(fn ($a) => $a->toArray(), $this->assignmentRepo->findByTaskId((int) $id)),\n 'results' => array_map(fn ($r) => $r->toArray(), $this->resultRepo->findByTaskId((int) $id)),\n 'comments' => array_map(fn ($c) => $c->toArray(), $this->commentRepo->findByTaskId((int) $id)),\n ]);\n }\n}\n",
"structuredPatch": [
{
"oldStart": 7,
"oldLines": 31,
"newStart": 7,
"newLines": 29,
"lines": [
" \/\/ @responsibility: HTTP-Endpunkte für Dokumentation und Task-Ansichten",
" ",
" use Domain\\Repository\\DokumentationRepositoryInterface;",
"+use Domain\\Repository\\KiProtokollRepositoryInterface;",
"+use Domain\\Repository\\TaskAssignmentRepositoryInterface;",
"+use Domain\\Repository\\TaskCommentRepositoryInterface;",
" use Domain\\Repository\\TaskRepositoryInterface;",
"+use Domain\\Repository\\TaskResultRepositoryInterface;",
" use Framework\\Controller;",
"-use Infrastructure\\Persistence\\DokumentationRepository;",
"-use Infrastructure\\Persistence\\KiProtokollRepository;",
"-use Infrastructure\\Persistence\\TaskAssignmentRepository;",
"-use Infrastructure\\Persistence\\TaskCommentRepository;",
"-use Infrastructure\\Persistence\\TaskRepository;",
"-use Infrastructure\\Persistence\\TaskResultRepository;",
" ",
" class DocsController extends Controller",
" {",
" private DokumentationRepositoryInterface $docsRepo;",
"- private KiProtokollRepository $protokollRepo;",
"+ private KiProtokollRepositoryInterface $protokollRepo;",
" private TaskRepositoryInterface $taskRepo;",
"- private TaskAssignmentRepository $assignmentRepo;",
"- private TaskResultRepository $resultRepo;",
"- private TaskCommentRepository $commentRepo;",
"+ private TaskAssignmentRepositoryInterface $assignmentRepo;",
"+ private TaskResultRepositoryInterface $resultRepo;",
"+ private TaskCommentRepositoryInterface $commentRepo;",
" ",
" public function __construct(",
"- DokumentationRepository $docsRepo,",
"- KiProtokollRepository $protokollRepo,",
"- TaskRepository $taskRepo,",
"- TaskAssignmentRepository $assignmentRepo,",
"- TaskResultRepository $resultRepo,",
"- TaskCommentRepository $commentRepo",
"+ DokumentationRepositoryInterface $docsRepo,",
"+ KiProtokollRepositoryInterface $protokollRepo,",
"+ TaskRepositoryInterface $taskRepo,",
"+ TaskAssignmentRepositoryInterface $assignmentRepo,",
"+ TaskResultRepositoryInterface $resultRepo,",
"+ TaskCommentRepositoryInterface $commentRepo",
" ) {",
" $this->docsRepo = $docsRepo;",
" $this->protokollRepo = $protokollRepo;"
]
}
],
"userModified": false,
"replaceAll": false
}
}