Backup #2143
| ID | 2143 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/UseCases/Config/ConfigDTO.php |
| Version | 4 |
| Typ |
modified |
| Größe | 2.4 KB |
| Hash | 1660c6d9224393187fa2b4f0649f0869563d7be0f3dabe719013be3bb036548d |
| Datum | 2025-12-30 20:39:13 |
| 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\Config;
// @responsibility: Datenübertragungsobjekt für Content-Konfigurationen
final class ConfigDTO
{
public function __construct(
public readonly ?int $id,
public readonly string $type,
public readonly string $name,
public readonly string $slug,
public readonly ?string $description,
public readonly string $content,
public readonly string $version,
public readonly string $status,
public readonly ?int $parentId,
public readonly ?int $promptId = null,
public readonly int $sortOrder = 0,
public readonly ?string $parentName = null,
public readonly ?string $createdAt = null,
public readonly ?string $updatedAt = null,
) {
}
public static function fromArray(array $data): self
{
return new self(
id: isset($data['id']) ? (int) $data['id'] : null,
type: $data['type'] ?? '',
name: $data['name'] ?? '',
slug: $data['slug'] ?? '',
description: $data['description'] ?? null,
content: $data['content'] ?? '{}',
version: $data['version'] ?? '1.0',
status: $data['status'] ?? 'draft',
parentId: isset($data['parent_id']) ? (int) $data['parent_id'] : null,
promptId: isset($data['prompt_id']) ? (int) $data['prompt_id'] : null,
sortOrder: (int) ($data['sort_order'] ?? 0),
parentName: $data['parent_name'] ?? null,
createdAt: $data['created_at'] ?? null,
updatedAt: $data['updated_at'] ?? null,
);
}
public function getContentDecoded(): ?array
{
$decoded = json_decode($this->content, true);
return is_array($decoded) ? $decoded : null;
}
public function toArray(): array
{
return [
'id' => $this->id,
'type' => $this->type,
'name' => $this->name,
'slug' => $this->slug,
'description' => $this->description,
'content' => $this->content,
'version' => $this->version,
'status' => $this->status,
'parent_id' => $this->parentId,
'parent_name' => $this->parentName,
'created_at' => $this->createdAt,
'updated_at' => $this->updatedAt,
];
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 2143 |
4 |
modified |
2.4 KB |
2025-12-30 20:39 |
| 2142 |
3 |
modified |
2.1 KB |
2025-12-30 20:37 |
| 726 |
2 |
modified |
2.0 KB |
2025-12-23 07:56 |
| 463 |
1 |
modified |
1.4 KB |
2025-12-22 10:30 |
← Zurück zur Übersicht