Backup #741
| ID | 741 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/UseCases/Command/CreatePromptCommand.php |
| Version | 1 |
| Typ |
modified |
| Größe | 1.3 KB |
| Hash | f9a2cf770e2728e4b4bbafe5e5a4bc4406595e5ce5bfc2c611af6ca167881a7b |
| Datum | 2025-12-23 07:58:14 |
| 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 creating a new prompt.
*/
final class CreatePromptCommand
{
public function __construct(
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(array $data): self
{
return new self(
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->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.';
}
if ($this->version === '') {
$errors[] = 'Version 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 |
| 1830 |
3 |
modified |
1.4 KB |
2025-12-27 23:17 |
| 1829 |
2 |
modified |
1.4 KB |
2025-12-27 23:17 |
| 741 |
1 |
modified |
1.3 KB |
2025-12-23 07:58 |
← Zurück zur Übersicht