Files
fewo-stommer/app/Console/Commands/CheckImageWorlds.php
Lars StommerandClaude Opus 5 4e66add1f0 Phase 6, Anwendungsseite: Bildwelten und die Marke je Website
Die Theme-Sitzung wartete darauf: Seebad ruft schon ortsneutrale Plätze
über `partials/motif` auf und behilft sich mit einem eigenen `motifs/`-
Ordner. Der Kommentar dort sagt es selbst – „so a later picture-world
system can replace the mapping below". Das System gibt es jetzt.

**Bildwelten** (A18–A20) sind Pakete wie Themes: `resources/image-worlds/
<key>/` mit `world.json` und `svg/`. Eine Website wählt eine Bildwelt, eine
Wohnung darf eine andere tragen – das ist der Platz für die Bergwohnung auf
einer Küsten-Website. Vorlagen fragen über `$theme->motif($slot)` nach einem
Platz, nie nach einer Datei.

Die Render-Logik ist aus Seebads Partial in die Anwendung gewandert, damit
jedes Theme sie bekommt: Inline-SVG (nimmt die Textfarbe an, kein zweiter
Request), Titel und ARIA entfernt, und die internen Ids je Aufruf eindeutig
gemacht – zwei Kopien derselben Grafik auf einer Seite würden sonst auf
denselben Verlauf zeigen und eine davon verlöre ihre Farben.

Ein leerer Platz ist kein Fehler: die Vorlage bekommt schlicht keine
Dekoration. Weil das leicht zu übersehen ist, meldet
`php artisan image-worlds:check`, welcher Platz ohne Datei dasteht.

**Marke je Website** (A14/A22): Logo, Favicon und ein Logo für E-Mail und
Vertrag als Medien der Website. Der Mietvertrag bettet die Datei ein statt
eine URL zu holen – er wird auf dem Server gerendert und darf nicht davon
abhängen, dass dieser sich selbst erreicht. Ohne Logo bleibt der Vertrag
wie bisher.

`resources/themes/**` ist unberührt: die Ostsee-Grafiken sind kopiert, nicht
verschoben. Was die Theme-Sitzung nun tun kann, steht in
ZUSAMMENARBEIT.md §6; ihr Wunsch aus §5 ist als erledigt vermerkt.

272 Feature-Tests grün.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-26 07:35:17 +01:00

72 lines
2.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Console\Commands;
use App\ImageWorlds\ImageWorldManifest;
use App\ImageWorlds\ImageWorldRegistry;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
#[Signature('image-worlds:check')]
#[Description('Check every picture world: does each slot in the manifest have its SVG file?')]
class CheckImageWorlds extends Command
{
/**
* A slot without a file is not an error at runtime – templates simply get no decoration. That makes it
* easy to miss, so it is reported here instead of silently leaving a page bare.
*/
public function handle(ImageWorldRegistry $registry): int
{
$worlds = $registry->all();
if ($worlds === []) {
$this->warn('Keine Bildwelt gefunden.');
return self::SUCCESS;
}
$incomplete = 0;
foreach ($worlds as $world) {
$missing = $world->missingFiles();
if ($missing === []) {
$this->info(sprintf('✓ %s (%s): %d Plätze', $world->name, $world->key, count($world->slots)));
continue;
}
$incomplete++;
$this->error(sprintf('✗ %s (%s): ohne Datei – %s', $world->name, $world->key, implode(', ', $missing)));
}
$this->newLine();
$this->line($this->slotOverview($worlds));
return $incomplete === 0 ? self::SUCCESS : self::FAILURE;
}
/**
* Which slot is filled by which world – so a template author sees what they may rely on.
*
* @param array<string, ImageWorldManifest> $worlds
*/
private function slotOverview(array $worlds): string
{
$slots = [];
foreach ($worlds as $world) {
foreach (array_keys($world->slots) as $slot) {
$slots[$slot][] = $world->key;
}
}
ksort($slots);
return collect($slots)
->map(fn (array $keys, string $slot): string => sprintf(' %-18s %s', $slot, implode(', ', $keys)))
->implode(PHP_EOL);
}
}