GenerateContentCommand.php
- Pfad:
src/UseCases/Command/GenerateContentCommand.php - Namespace: UseCases\Command
- Zeilen: 63 | Größe: 1,473 Bytes
- Geändert: 2025-12-23 07:57:57 | 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
-
GenerateContentCommandclass Zeile 9
Funktionen 4
-
__construct()public Zeile 11 -
fromRequest()public Zeile 22 -
validate()public Zeile 35 -
isValid()public Zeile 58
Verwendet von 1
Versionen 1
-
v1
2025-12-23 07:57 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace UseCases\Command;
// @responsibility: Command-Objekt für Content-Generierung
final class GenerateContentCommand
{
public function __construct(
public readonly int $orderId,
public readonly string $model,
public readonly string $collection,
public readonly int $contextLimit,
) {
}
/**
* @param array<string, mixed> $data
*/
public static function fromRequest(int $orderId, array $data): self
{
return new self(
orderId: $orderId,
model: (string) ($data['model'] ?? 'claude-opus-4-5-20251101'),
collection: (string) ($data['collection'] ?? 'documents'),
contextLimit: (int) ($data['context_limit'] ?? 5),
);
}
/**
* @return array<string>
*/
public function validate(): array
{
$errors = [];
if ($this->orderId < 1) {
$errors[] = 'Ungültige Order-ID.';
}
if ($this->model === '') {
$errors[] = 'Modell ist erforderlich.';
}
if ($this->collection === '') {
$errors[] = 'Collection ist erforderlich.';
}
if ($this->contextLimit < 1 || $this->contextLimit > 20) {
$errors[] = 'Context-Limit muss zwischen 1 und 20 liegen.';
}
return $errors;
}
public function isValid(): bool
{
return $this->validate() === [];
}
}