Files
Mangarr/src/Service/MangaProviderFactory.php

18 lines
402 B
PHP

<?php
namespace App\Service;
use App\Interface\ContentProviderInterface;
class MangaProviderFactory
{
public static function create($providerName): ContentProviderInterface
{
return match ($providerName) {
'LelScans' => new LelScansProviderService(),
'AutreManga' => new AutreMangaProviderService(),
default => throw new \Exception("Provider {$providerName} non supporté."),
};
}
}