{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/ValueObject\/ExecutionDuration.php",
"old_string": " return $diff * 1000;",
"new_string": " return $diff * Constants::MS_PER_SECOND;"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/ValueObject\/ExecutionDuration.php",
"oldString": " return $diff * 1000;",
"newString": " return $diff * Constants::MS_PER_SECOND;",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Domain\\ValueObject;\n\n\/\/ @responsibility: Immutables Value Object für Ausführungsdauer mit Zeitstempeln\n\nuse Domain\\Constants;\nuse InvalidArgumentException;\n\nfinal class ExecutionDuration\n{\n private \\DateTimeImmutable $requestedAt;\n private ?\\DateTimeImmutable $respondedAt;\n\n private function __construct(\\DateTimeImmutable $requestedAt, ?\\DateTimeImmutable $respondedAt)\n {\n if ($respondedAt !== null && $respondedAt < $requestedAt) {\n throw new InvalidArgumentException('Response timestamp cannot be before request timestamp');\n }\n\n $this->requestedAt = $requestedAt;\n $this->respondedAt = $respondedAt;\n }\n\n public static function start(\\DateTimeImmutable $requestedAt): self\n {\n return new self($requestedAt, null);\n }\n\n public static function completed(\\DateTimeImmutable $requestedAt, \\DateTimeImmutable $respondedAt): self\n {\n return new self($requestedAt, $respondedAt);\n }\n\n public static function now(): self\n {\n return new self(new \\DateTimeImmutable(), null);\n }\n\n public function complete(\\DateTimeImmutable $respondedAt): self\n {\n return new self($this->requestedAt, $respondedAt);\n }\n\n public function completeNow(): self\n {\n return new self($this->requestedAt, new \\DateTimeImmutable());\n }\n\n public function requestedAt(): \\DateTimeImmutable\n {\n return $this->requestedAt;\n }\n\n public function respondedAt(): ?\\DateTimeImmutable\n {\n return $this->respondedAt;\n }\n\n public function durationMs(): ?int\n {\n if ($this->respondedAt === null) {\n return null;\n }\n\n $diff = $this->respondedAt->getTimestamp() - $this->requestedAt->getTimestamp();\n\n return $diff * 1000;\n }\n\n public function isCompleted(): bool\n {\n return $this->respondedAt !== null;\n }\n\n public function format(): string\n {\n $duration = $this->durationMs();\n\n if ($duration === null) {\n return 'In progress';\n }\n\n if ($duration < 1000) {\n return \"{$duration}ms\";\n }\n\n return sprintf('%.2fs', $duration \/ 1000);\n }\n\n public function toArray(): array\n {\n return [\n 'requested_at' => $this->requestedAt->format('Y-m-d H:i:s.u'),\n 'responded_at' => $this->respondedAt?->format('Y-m-d H:i:s.u'),\n 'duration_ms' => $this->durationMs(),\n ];\n }\n}\n",
"structuredPatch": [
{
"oldStart": 67,
"oldLines": 7,
"newStart": 67,
"newLines": 7,
"lines": [
" ",
" $diff = $this->respondedAt->getTimestamp() - $this->requestedAt->getTimestamp();",
" ",
"- return $diff * 1000;",
"+ return $diff * Constants::MS_PER_SECOND;",
" }",
" ",
" public function isCompleted(): bool"
]
}
],
"userModified": false,
"replaceAll": false
}
}