Backup #735
| ID | 735 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/UseCases/Content/ContentGenerationResult.php |
| Version | 1 |
| Typ |
modified |
| Größe | 1.7 KB |
| Hash | b1080fad51adf368f25ea432ee36f1322ee71fd049189561232b4f0a74efb655 |
| Datum | 2025-12-23 07:57:37 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
namespace UseCases\Content;
/**
* ContentGenerationResult - DTO for content generation results
*/
final class ContentGenerationResult
{
public function __construct(
private string $content = '',
private array $sources = [],
private ?int $versionNumber = null,
private ?string $error = null,
) {
}
public function getContent(): string
{
return $this->content;
}
public function getSources(): array
{
return $this->sources;
}
public function getVersionNumber(): ?int
{
return $this->versionNumber;
}
public function getError(): ?string
{
return $this->error;
}
public function hasError(): bool
{
return $this->error !== null;
}
public function isSuccess(): bool
{
return $this->error === null;
}
/**
* Create from Python script result
*/
public static function fromPythonResult(array $result): self
{
if (isset($result['error'])) {
return new self(error: $result['error']);
}
return new self(
content: $result['content'] ?? '',
sources: $result['sources'] ?? [],
versionNumber: $result['version_number'] ?? null,
);
}
/**
* Create error result
*/
public static function error(string $message): self
{
return new self(error: $message);
}
/**
* Convert to array for view rendering
*/
public function toArray(): array
{
return [
'content' => $this->content,
'sources' => $this->sources,
'version_number' => $this->versionNumber,
'error' => $this->error,
];
}
}
Vollständig herunterladen
Aktionen
← Zurück zur Übersicht