{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/CrawlerController.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Controller;\n\n\/\/ @responsibility: HTTP-Endpunkte fuer Crawl-Liste und Crawl-Detail\n\nuse Framework\\Controller;\nuse Infrastructure\\Crawler\\CrawlerConnection;\nuse Infrastructure\\Crawler\\CrawlerCrawlRepository;\nuse Infrastructure\\Crawler\\CrawlerErrorRepository;\nuse Infrastructure\\Crawler\\CrawlerPageRepository;\nuse Infrastructure\\Crawler\\CrawlerStatsRepository;\n\nclass CrawlerController extends Controller\n{\n public function index(): void\n {\n $repo = new CrawlerCrawlRepository(CrawlerConnection::pdo());\n $this->view('crawler.index', [\n 'title' => 'Crawler',\n 'crawls' => $repo->listRecent(50),\n ]);\n }\n\n public function show(int $id): void\n {\n $pdo = CrawlerConnection::pdo();\n $crawl = (new CrawlerCrawlRepository($pdo))->find($id);\n if ($crawl === null) {\n $this->notFound('Crawl nicht gefunden');\n return;\n }\n $this->view('crawler.show', [\n 'title' => 'Crawl #' . $id,\n 'crawl' => $crawl,\n 'pages' => (new CrawlerPageRepository($pdo))->listByCrawl($id, 200, 0),\n 'stats' => (new CrawlerStatsRepository($pdo))->forCrawl($id),\n ]);\n }\n\n public function errors(int $id): void\n {\n $pdo = CrawlerConnection::pdo();\n $crawl = (new CrawlerCrawlRepository($pdo))->find($id);\n if ($crawl === null) {\n $this->notFound('Crawl nicht gefunden');\n return;\n }\n $this->view('crawler.errors', [\n 'title' => 'Fehler #' . $id,\n 'crawl' => $crawl,\n 'errors' => (new CrawlerErrorRepository($pdo))->listByCrawl($id),\n ]);\n }\n}\n"
}
}