<?php

declare(strict_types=1);

namespace App\Framework\Debug\Outputs;

use App\Framework\Debug\DebugEntry;
use App\Framework\Debug\Formatters\FormatterInterface;
use App\Framework\Debug\OutputInterface;

/**
 * Ausgabeklasse für HTML-Umgebungen.
 */
final class HtmlOutput implements OutputInterface
{
    /**
     * {@inheritdoc}
     */
    public function output(DebugEntry $entry, FormatterInterface $formatter): void
    {
        echo $formatter->format($entry);
    }

    /**
     * {@inheritdoc}
     */
    public function outputHistory(array $entries, FormatterInterface $formatter): void
    {
        echo $formatter->formatHistory($entries);
    }

    /**
     * {@inheritdoc}
     */
    public function outputRaw(string $text): void
    {
        echo "<div class='debug-raw'>", htmlspecialchars($text), "</div>";
    }
}
