Texte, Materialart und Präsentationsmedien bleiben am Medium, Modul, Programm und Lizenzartikel und werden von Verwaltung und Karten aus derselben Quelle gelesen, ohne Fassung oder Lizenz zu verändern. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Catalog;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Aufgelöste Klasse-A-Angaben eines Fachobjekts.
|
|
* Fehlende Felder bleiben leer. Es wird nichts materialisiert.
|
|
*/
|
|
final readonly class EditorialProfile
|
|
{
|
|
/**
|
|
* @param array<string, ResolvedText> $texts
|
|
*/
|
|
public function __construct(
|
|
public ?string $workingTitle,
|
|
public array $texts,
|
|
public ?string $searchTerms,
|
|
public string $searchOrigin,
|
|
public ?string $kindLabel,
|
|
public ?Model $source,
|
|
) {}
|
|
|
|
public function text(string $field): ResolvedText
|
|
{
|
|
return $this->texts[$field] ?? new ResolvedText(null, 'leer', null);
|
|
}
|
|
|
|
public function value(string $field): ?string
|
|
{
|
|
return $this->text($field)->value;
|
|
}
|
|
|
|
public function origin(string $field): string
|
|
{
|
|
return $this->text($field)->origin;
|
|
}
|
|
|
|
public function originLabel(string $field): string
|
|
{
|
|
$text = $this->text($field);
|
|
|
|
return match ($text->origin) {
|
|
'eigen' => 'Eigene Angabe',
|
|
'variante' => 'Abweichung für '.($text->label ?? 'diesen Kontext'),
|
|
'quelle' => 'Übernommen von '.($text->label ?? 'der fachlichen Quelle'),
|
|
default => 'Keine Angabe',
|
|
};
|
|
}
|
|
}
|