Initial commit - Last War messaging system
This commit is contained in:
26
common/helpers/sender_factory.php
Executable file
26
common/helpers/sender_factory.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Helpers;
|
||||
|
||||
require_once __DIR__ . '/../../discord/DiscordSender.php';
|
||||
require_once __DIR__ . '/../../telegram/TelegramSender.php';
|
||||
|
||||
use Discord\DiscordSender;
|
||||
use Telegram\TelegramSender;
|
||||
|
||||
class SenderFactory
|
||||
{
|
||||
public static function create(string $platform): object
|
||||
{
|
||||
return match ($platform) {
|
||||
'discord' => new DiscordSender(),
|
||||
'telegram' => new TelegramSender(),
|
||||
default => throw new \InvalidArgumentException("Plataforma no soportada: $platform"),
|
||||
};
|
||||
}
|
||||
|
||||
public static function getPlatforms(): array
|
||||
{
|
||||
return ['discord', 'telegram'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user