{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Crawler\/CrawlerCrawlRepository.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\Crawler;\n\n\/\/ @responsibility: Lesezugriff auf crawler.crawls (Liste, Detail)\n\nuse Domain\\Crawler\\CrawlSummary;\n\nfinal class CrawlerCrawlRepository\n{\n public function __construct(private \\PDO $pdo)\n {\n }\n\n \/**\n * @return list<CrawlSummary>\n *\/\n public function listRecent(int $limit = 50): array\n {\n $stmt = $this->pdo->prepare(\n 'SELECT * FROM crawls ORDER BY started_at DESC LIMIT :limit',\n );\n $stmt->bindValue(':limit', $limit, \\PDO::PARAM_INT);\n $stmt->execute();\n\n return array_map([$this, 'hydrate'], $stmt->fetchAll());\n }\n\n public function find(int $id): ?CrawlSummary\n {\n $stmt = $this->pdo->prepare('SELECT * FROM crawls WHERE id = :id');\n $stmt->execute([':id' => $id]);\n $row = $stmt->fetch();\n\n return $row !== false ? $this->hydrate($row) : null;\n }\n\n \/**\n * @param array<string, mixed> $row\n *\/\n private function hydrate(array $row): CrawlSummary\n {\n return new CrawlSummary(\n id: (int) $row['id'],\n baseUrl: (string) $row['base_url'],\n mode: (string) $row['mode'],\n status: (string) $row['status'],\n startedAt: (string) $row['started_at'],\n finishedAt: $row['finished_at'] !== null ? (string) $row['finished_at'] : null,\n totalUrls: (int) $row['total_urls'],\n totalErrors: (int) $row['total_errors'],\n triggerSource: (string) $row['trigger_source'],\n );\n }\n}\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Crawler\/CrawlerCrawlRepository.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\Crawler;\n\n\/\/ @responsibility: Lesezugriff auf crawler.crawls (Liste, Detail)\n\nuse Domain\\Crawler\\CrawlSummary;\n\nfinal class CrawlerCrawlRepository\n{\n public function __construct(private \\PDO $pdo)\n {\n }\n\n \/**\n * @return list<CrawlSummary>\n *\/\n public function listRecent(int $limit = 50): array\n {\n $stmt = $this->pdo->prepare(\n 'SELECT * FROM crawls ORDER BY started_at DESC LIMIT :limit',\n );\n $stmt->bindValue(':limit', $limit, \\PDO::PARAM_INT);\n $stmt->execute();\n\n return array_map([$this, 'hydrate'], $stmt->fetchAll());\n }\n\n public function find(int $id): ?CrawlSummary\n {\n $stmt = $this->pdo->prepare('SELECT * FROM crawls WHERE id = :id');\n $stmt->execute([':id' => $id]);\n $row = $stmt->fetch();\n\n return $row !== false ? $this->hydrate($row) : null;\n }\n\n \/**\n * @param array<string, mixed> $row\n *\/\n private function hydrate(array $row): CrawlSummary\n {\n return new CrawlSummary(\n id: (int) $row['id'],\n baseUrl: (string) $row['base_url'],\n mode: (string) $row['mode'],\n status: (string) $row['status'],\n startedAt: (string) $row['started_at'],\n finishedAt: $row['finished_at'] !== null ? (string) $row['finished_at'] : null,\n totalUrls: (int) $row['total_urls'],\n totalErrors: (int) $row['total_errors'],\n triggerSource: (string) $row['trigger_source'],\n );\n }\n}\n",
"structuredPatch": [],
"originalFile": null,
"userModified": false
}
}