DocsController.php
- Pfad:
src/Controller/DocsController.php - Namespace: Controller
- Zeilen: 134 | Größe: 4,193 Bytes
- Geändert: 2025-12-25 12:52:36 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 95
- Dependencies: 80 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Dependencies 14
- extends Framework\Controller
- constructor Domain\Repository\DokumentationRepositoryInterface
- constructor Domain\Repository\KiProtokollRepositoryInterface
- constructor Domain\Repository\TaskRepositoryInterface
- constructor Domain\Repository\TaskAssignmentRepositoryInterface
- constructor Domain\Repository\TaskResultRepositoryInterface
- constructor Domain\Repository\TaskCommentRepositoryInterface
- 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
Klassen 1
-
DocsControllerclass Zeile 17
Funktionen 8
-
__construct()public Zeile 26 -
index()public Zeile 42 -
redirectBySlug()public Zeile 50 -
show()public Zeile 62 -
tasksIndex()public Zeile 87 -
tasksNew()public Zeile 96 -
tasksEdit()public Zeile 103 -
taskShow()public Zeile 117
Versionen 14
-
v14
2025-12-25 12:52 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v13
2025-12-23 07:52 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v12
2025-12-23 04:42 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v11
2025-12-22 08:59 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v10
2025-12-22 08:27 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v9
2025-12-22 08:27 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v8
2025-12-22 08:27 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v7
2025-12-22 08:27 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v6
2025-12-22 08:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v5
2025-12-22 01:46 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v4
2025-12-22 01:46 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v3
2025-12-22 01:46 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v2
2025-12-22 01:46 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-20 01:50 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace Controller;
// @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;
class DocsController extends Controller
{
private DokumentationRepositoryInterface $docsRepo;
private KiProtokollRepositoryInterface $protokollRepo;
private TaskRepositoryInterface $taskRepo;
private TaskAssignmentRepositoryInterface $assignmentRepo;
private TaskResultRepositoryInterface $resultRepo;
private TaskCommentRepositoryInterface $commentRepo;
public function __construct(
DokumentationRepositoryInterface $docsRepo,
KiProtokollRepositoryInterface $protokollRepo,
TaskRepositoryInterface $taskRepo,
TaskAssignmentRepositoryInterface $assignmentRepo,
TaskResultRepositoryInterface $resultRepo,
TaskCommentRepositoryInterface $commentRepo
) {
$this->docsRepo = $docsRepo;
$this->protokollRepo = $protokollRepo;
$this->taskRepo = $taskRepo;
$this->assignmentRepo = $assignmentRepo;
$this->resultRepo = $resultRepo;
$this->commentRepo = $commentRepo;
}
public function index(): void
{
$this->view('docs.index', [
'title' => 'Dokumentation',
'hierarchy' => $this->docsRepo->getHierarchy(),
]);
}
public function redirectBySlug(string $slug): void
{
$doc = $this->docsRepo->findDocBySlug($slug);
if ($doc === null) {
$this->notFound('Dokumentation nicht gefunden: ' . $slug);
}
header('Location: /docs' . $doc['path'], true, 301);
exit;
}
public function show(string $path): void
{
$path = '/' . ltrim($path, '/');
$doc = $this->docsRepo->findByPath($path);
if ($doc === null) {
$this->notFound('Dokumentation nicht gefunden: ' . $path);
}
$data = [
'title' => $doc['title'],
'doc' => $doc,
'breadcrumb' => $this->docsRepo->getBreadcrumb((int) $doc['id']),
'children' => $this->docsRepo->findChildren((int) $doc['id']),
'siblings' => $this->docsRepo->getSiblings((int) $doc['id']),
];
// Modul-spezifische Daten laden
if ($doc['slug'] === 'ki-protokoll') {
$data['entries'] = $this->protokollRepo->findLatest(20);
}
$this->view('docs.show', $data);
}
public function tasksIndex(): void
{
$this->view('tasks.index', [
'title' => 'Tasks',
'stats' => $this->taskRepo->getStatistics(),
'tasks' => array_map(fn ($t) => $t->toArray(), $this->taskRepo->findAll([], 50, 0)),
]);
}
public function tasksNew(): void
{
$this->view('tasks.new', [
'title' => 'Neuer Task',
]);
}
public function tasksEdit(string $id): void
{
$task = $this->taskRepo->findById((int) $id);
if ($task === null) {
$this->notFound('Task nicht gefunden');
}
$this->view('tasks.edit', [
'title' => 'Task bearbeiten',
'task' => $task->toArray(),
]);
}
public function taskShow(string $id): void
{
$task = $this->taskRepo->findById((int) $id);
if ($task === null) {
$this->notFound('Task nicht gefunden');
}
$this->view('tasks.show', [
'title' => 'Task #' . $id,
'task' => $task->toArray(),
'assignments' => array_map(fn ($a) => $a->toArray(), $this->assignmentRepo->findByTaskId((int) $id)),
'results' => array_map(fn ($r) => $r->toArray(), $this->resultRepo->findByTaskId((int) $id)),
'comments' => array_map(fn ($c) => $c->toArray(), $this->commentRepo->findByTaskId((int) $id)),
]);
}
}