ProtokollDTO.php
- Pfad:
src/UseCases/Protokoll/ProtokollDTO.php - Namespace: UseCases\Protokoll
- Zeilen: 81 | Größe: 3,302 Bytes
- Geändert: 2025-12-29 09:04:04 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 100
- Dependencies: 100 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Klassen 1
-
ProtokollDTOclass Zeile 9
Funktionen 3
-
__construct()public Zeile 11 -
fromArray()public Zeile 33 -
toArray()public Zeile 57
Versionen 5
-
v5
2025-12-29 09:04 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v4
2025-12-29 09:03 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v3
2025-12-29 09:03 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v2
2025-12-23 07:56 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-22 10:31 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace UseCases\Protokoll;
// @responsibility: Datenübertragungsobjekt für KI-Protokoll-Einträge
final class ProtokollDTO
{
public function __construct(
public readonly int $id,
public readonly ?string $timestamp,
public readonly ?string $clientName,
public readonly ?string $modelName,
public readonly ?string $request,
public readonly ?string $response,
public readonly ?string $status,
public readonly ?int $tokensTotal,
public readonly ?int $durationMs,
public readonly ?string $requestPreview = null,
public readonly ?string $requestFormatted = null,
public readonly ?string $responseFormatted = null,
public readonly ?string $requestIp = null,
public readonly ?string $requestTimestamp = null,
public readonly ?string $responseTimestamp = null,
public readonly ?int $tokensInput = null,
public readonly ?int $tokensOutput = null,
public readonly ?string $errorMessage = null,
) {
}
public static function fromArray(array $data): self
{
return new self(
id: (int) $data['id'],
timestamp: $data['timestamp'] ?? null,
clientName: $data['client_name'] ?? null,
modelName: $data['model_name'] ?? null,
request: $data['request'] ?? null,
response: $data['response'] ?? null,
status: $data['status'] ?? null,
tokensTotal: isset($data['tokens_total']) ? (int) $data['tokens_total'] : null,
durationMs: isset($data['duration_ms']) ? (int) $data['duration_ms'] : null,
requestPreview: $data['request_preview'] ?? null,
requestFormatted: $data['request_formatted'] ?? null,
responseFormatted: $data['response_formatted'] ?? null,
requestIp: $data['request_ip'] ?? null,
requestTimestamp: $data['request_timestamp'] ?? null,
responseTimestamp: $data['response_timestamp'] ?? null,
tokensInput: isset($data['tokens_input']) ? (int) $data['tokens_input'] : null,
tokensOutput: isset($data['tokens_output']) ? (int) $data['tokens_output'] : null,
errorMessage: $data['error_message'] ?? null,
);
}
public function toArray(): array
{
return [
'id' => $this->id,
'timestamp' => $this->timestamp,
'client_name' => $this->clientName,
'model_name' => $this->modelName,
'request' => $this->request,
'response' => $this->response,
'status' => $this->status,
'tokens_total' => $this->tokensTotal,
'duration_ms' => $this->durationMs,
'request_preview' => $this->requestPreview,
'request_formatted' => $this->requestFormatted,
'response_formatted' => $this->responseFormatted,
'request_ip' => $this->requestIp,
'request_timestamp' => $this->requestTimestamp,
'response_timestamp' => $this->responseTimestamp,
'tokens_input' => $this->tokensInput,
'tokens_output' => $this->tokensOutput,
'error_message' => $this->errorMessage,
];
}
}