Files
KanbanGit/app/Enums/NotificationEventType.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

42 lines
1018 B
PHP

<?php
namespace App\Enums;
enum NotificationEventType: string
{
case TicketStatusChanged = 'ticket_status_changed';
public function label(): string
{
return match ($this) {
self::TicketStatusChanged => 'Ticket status changed',
};
}
/**
* @return array<int, array{label: string, value: string}>
*/
public static function options(): array
{
return array_map(
fn (self $eventType): array => [
'label' => $eventType->label(),
'value' => $eventType->value,
],
self::cases(),
);
}
/**
* @param array<int, self>|null $notificationEventTypes
* @return array<int, string>
*/
public static function values(?array $notificationEventTypes = null): array
{
return array_map(
fn (self $notificationEventType): string => $notificationEventType->value,
$notificationEventTypes ?? self::cases(),
);
}
}