Backup #2152
| ID | 2152 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/UseCases/Command/CreateContentOrderCommand.php |
| Version | 3 |
| Typ |
modified |
| Größe | 2.7 KB |
| Hash | 61c8646bc814c7ca3b5e02e9dcf8073a39fa176fbaf4dddbcc8d6a094f3df3ad |
| Datum | 2025-12-30 22:19:41 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
declare(strict_types=1);
namespace UseCases\Command;
// @responsibility: Command-Objekt für Content-Auftragserstellung
final class CreateContentOrderCommand
{
/**
* @param array<string> $collections
* @param array<int> $selectedCritics
*/
public function __construct(
public readonly string $title,
public readonly string $briefing,
public readonly string $model,
public readonly array $collections,
public readonly int $contextLimit,
public readonly ?int $authorProfileId,
public readonly ?int $contractId,
public readonly ?int $structureId,
public readonly string $action,
public readonly float $temperature = 0.5,
public readonly int $maxTokens = 4096,
public readonly ?int $systemPromptId = null,
public readonly array $selectedCritics = [],
public readonly bool $qualityCheck = false,
) {
}
/**
* @param array<string, mixed> $data
*/
public static function fromRequest(array $data): self
{
$collections = $data['collections'] ?? ['documents'];
if (!is_array($collections)) {
$collections = [$collections];
}
return new self(
title: trim((string) ($data['title'] ?? '')),
briefing: trim((string) ($data['briefing'] ?? '')),
model: (string) ($data['model'] ?? 'mistral'),
collections: $collections,
contextLimit: (int) ($data['context_limit'] ?? 5),
authorProfileId: !empty($data['author_profile_id']) ? (int) $data['author_profile_id'] : null,
contractId: !empty($data['contract_id']) ? (int) $data['contract_id'] : null,
structureId: !empty($data['structure_id']) ? (int) $data['structure_id'] : null,
action: (string) ($data['action'] ?? 'save'),
);
}
/**
* Validate the command data.
*
* @return array<string> List of validation errors (empty if valid)
*/
public function validate(): array
{
$errors = [];
if ($this->title === '') {
$errors[] = 'Titel ist erforderlich.';
}
if ($this->briefing === '') {
$errors[] = 'Briefing ist erforderlich.';
}
if ($this->contextLimit < 1 || $this->contextLimit > 20) {
$errors[] = 'Context-Limit muss zwischen 1 und 20 liegen.';
}
if (empty($this->collections)) {
$errors[] = 'Mindestens eine Collection ist erforderlich.';
}
return $errors;
}
public function isValid(): bool
{
return $this->validate() === [];
}
public function shouldGenerate(): bool
{
return $this->action === 'generate';
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 2152 |
3 |
modified |
2.7 KB |
2025-12-30 22:19 |
| 2151 |
2 |
modified |
2.4 KB |
2025-12-30 22:19 |
| 736 |
1 |
modified |
2.5 KB |
2025-12-23 07:57 |
← Zurück zur Übersicht