<?php

declare(strict_types=1);

namespace PpPhp\Core\Platform\Foundation;

final class PlatformSerializer
{
    public function toJson(PlatformObject|PlatformCollection $value): string
    {
        return json_encode($value->toArray(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ?: '{}';
    }
}
