36 lines
729 B
PHP
36 lines
729 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Enums;
|
||
|
|
|
||
|
|
enum MatchStatus: string
|
||
|
|
{
|
||
|
|
case Scheduled = 'scheduled';
|
||
|
|
case InProgress = 'in_progress';
|
||
|
|
case Finished = 'finished';
|
||
|
|
case Cancelled = 'cancelled';
|
||
|
|
|
||
|
|
public function label(): string
|
||
|
|
{
|
||
|
|
return match ($this) {
|
||
|
|
self::Scheduled => 'Scheduled',
|
||
|
|
self::InProgress => 'In progress',
|
||
|
|
self::Finished => 'Finished',
|
||
|
|
self::Cancelled => 'Cancelled',
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
public static function options(): array
|
||
|
|
{
|
||
|
|
$options = [];
|
||
|
|
|
||
|
|
foreach (self::cases() as $case) {
|
||
|
|
$options[$case->value] = $case->label();
|
||
|
|
}
|
||
|
|
|
||
|
|
return $options;
|
||
|
|
}
|
||
|
|
}
|