events-venues/app/Services/Faker/Image/FakerImageProvider.php

33 lines
755 B
PHP

<?php
/**
* @package: events-venues-task
* @author: Yevhen Odynets
* @date: 2024-07-26
* @time: 19:56
*/
declare(strict_types=1);
namespace App\Services\Faker\Image;
use App\Services\Faker\Image\Providers\LoremFlickrFactory;
use App\Services\Faker\Image\Contracts\{ProviderFactoryInterface, FakerImageProviderType};
use RuntimeException;
class FakerImageProvider
{
public static function use(FakerImageProviderType $type): ProviderFactoryInterface
{
if ($type === FakerImageProviderType::LoremFlickr) {
{
return new LoremFlickrFactory();
}
} else {
{
throw new RuntimeException("Unknown image provider: " . $type->name);
}
}
}
}