Backup #737
| ID | 737 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/UseCases/Command/GenerateContentCommand.php |
| Version | 1 |
| Typ |
modified |
| Größe | 1.4 KB |
| Hash | cc7c08e6366a45fd9ac7b24254c48fed09ef4e4381ed020dc9ca2c71c9f58eb8 |
| Datum | 2025-12-23 07:57:57 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
namespace UseCases\Command;
/**
* Command for generating content for an existing order.
*/
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() === [];
}
}
Vollständig herunterladen
Aktionen
← Zurück zur Übersicht