quiniela-sembradores-backend/app/Enums/MatchOutcome.php

34 lines
598 B
PHP
Raw Normal View History

2026-03-19 18:18:18 -06:00
<?php
namespace App\Enums;
enum MatchOutcome: string
{
case Home = 'home';
case Draw = 'draw';
case Away = 'away';
public function label(): string
{
return match ($this) {
self::Home => 'Home win',
self::Draw => 'Draw',
self::Away => 'Away win',
};
}
/**
* @return array<string, string>
*/
public static function options(): array
{
$options = [];
foreach (self::cases() as $case) {
$options[$case->value] = $case->label();
}
return $options;
}
}