32 lines
645 B
PHP
32 lines
645 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
enum NotificationChannel: string
|
|
{
|
|
case Discord = 'discord';
|
|
case Webhook = 'webhook';
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::Discord => 'Discord',
|
|
self::Webhook => 'Webhook',
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @return array<int, array{label: string, value: string}>
|
|
*/
|
|
public static function options(): array
|
|
{
|
|
return array_map(
|
|
fn (self $channel): array => [
|
|
'label' => $channel->label(),
|
|
'value' => $channel->value,
|
|
],
|
|
self::cases(),
|
|
);
|
|
}
|
|
}
|