Files
KanbanGit/app/Enums/NotificationChannel.php
T
Twyco e66b798429
linter / quality (pull_request) Successful in 1m20s
tests / ci (8.4) (pull_request) Failing after 1m31s
replaced allowed mentions with enum
2026-04-25 18:55:05 +02:00

44 lines
1018 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(),
);
}
/**
* @param array<int, self>|null $notificationChannels
* @return array<int, string>
*/
public static function values(?array $notificationChannels = null): array
{
return array_map(
fn (self $notificationChannel): string => $notificationChannel->value,
$notificationChannels ?? self::cases(),
);
}
}