<?php

namespace IpagWoocommerce;

abstract class SerializerUtils
{
    public static function getSerializerInstances(): array
    {
        return [new JsonSerializer(), new XmlSerializer()];
    }

    public static function getSuitableSerializer(string $data): ?SerializerInterface
    {
        foreach (self::getSerializerInstances() as $serializer) {
            if ($serializer->isApplicable($data)) {
                return $serializer;
            }
        }

        return null;
    }
}