You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
json2db/app/Enums/FileFormatEnum.php

27 lines
534 B

<?php
namespace App\Enums;
use App\Services\Chunkers\JsonChunker;
use App\Services\Converters\JsonToDatabaseConverter;
enum FileFormatEnum: string
{
case JSON = 'json';
public function chunker(string $uuid, string $path): \Generator
{
$chunker = match ($this) {
self::JSON => new JsonChunker
};
return $chunker->handle($uuid, $path);
}
public function converter()
{
return match($this){
self::JSON => new JsonToDatabaseConverter
};
}
}