Backup #1834
| ID | 1834 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/UseCases/Command/UpdatePromptCommand.php |
| Version | 3 |
| Typ |
modified |
| Größe | 1.5 KB |
| Hash | 22b03dff328f1f088d220160e963c8f1c2df3e26277e2e86536f0024e29314d0 |
| Datum | 2025-12-27 23:18:43 |
| 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 Prompt-Aktualisierung
use Domain\Constants;
final class UpdatePromptCommand
{
public function __construct(
public readonly int $id,
public readonly string $name,
public readonly string $version,
public readonly string $content,
public readonly bool $isActive,
) {
}
/**
* @param array<string, mixed> $data
*/
public static function fromRequest(int $id, array $data): self
{
return new self(
id: $id,
name: trim((string) ($data['name'] ?? '')),
version: trim((string) ($data['version'] ?? '1.0')),
content: trim((string) ($data['content'] ?? '')),
isActive: isset($data['is_active']),
);
}
/**
* @return array<string>
*/
public function validate(): array
{
$errors = [];
if ($this->id < 1) {
$errors[] = 'Ungültige Prompt-ID.';
}
if ($this->name === '') {
$errors[] = 'Name ist erforderlich.';
}
if (mb_strlen($this->name) > 100) {
$errors[] = 'Name darf maximal 100 Zeichen lang sein.';
}
if ($this->content === '') {
$errors[] = 'Inhalt ist erforderlich.';
}
return $errors;
}
public function isValid(): bool
{
return $this->validate() === [];
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 1834 |
3 |
modified |
1.5 KB |
2025-12-27 23:18 |
| 1833 |
2 |
modified |
1.4 KB |
2025-12-27 23:18 |
| 742 |
1 |
modified |
1.4 KB |
2025-12-23 07:58 |
← Zurück zur Übersicht