$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 */ 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() === []; } }