<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Compiler;

final class EventArtifactWriter
{
    public function writePhpArray(string $file, array $data): void
    {
        EventCompilerPaths::ensureDir($file);
        file_put_contents($file, "<?php\nreturn " . var_export($data, true) . ";\n");
    }

    public function writeJson(string $file, array $data): void
    {
        EventCompilerPaths::ensureDir($file);
        file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
    }
}
