<?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 Konsolen-Umgebungen.
 */
final class ConsoleOutput implements OutputInterface
{
    /**
     * {@inheritdoc}
     */
    public function output(DebugEntry $entry, FormatterInterface $formatter): void
    {
        fwrite(STDOUT, $formatter->format($entry));
    }

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

    /**
     * {@inheritdoc}
     */
    public function outputRaw(string $text): void
    {
        fwrite(STDOUT, $text);
    }
}
