47 lines
858 B
PHP
47 lines
858 B
PHP
<?php
|
|
|
|
namespace App\Enums\Advices;
|
|
|
|
use App\Traits\Enums\BaseEnum;
|
|
|
|
enum AdviceTimeEnum: int
|
|
{
|
|
use BaseEnum;
|
|
|
|
case first = 1;
|
|
case second = 2;
|
|
case third = 3;
|
|
case fourth = 4;
|
|
|
|
/**
|
|
* Optionnal labels definition.
|
|
*
|
|
* @phpstan-ignore-next-line
|
|
*/
|
|
private const LABELS = [
|
|
self::first->name => '0 - 30min',
|
|
self::second->name => '31min - 2h',
|
|
self::third->name => '2h - 4h',
|
|
self::fourth->name => '> 4h',
|
|
];
|
|
|
|
/**
|
|
* Optionnal labels definition.
|
|
*/
|
|
private const TIMES = [
|
|
'first' => [0, 30],
|
|
'second' => [31, 120],
|
|
'third' => [120, 240],
|
|
'fourth' => [240, 1440]
|
|
];
|
|
|
|
/**
|
|
* Get time.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function times(): array
|
|
{
|
|
return self::TIMES[$this->name];
|
|
}
|
|
}
|