71 lines
1.4 KiB
PHP
71 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Enums\Advices;
|
|
|
|
use Kwaadpepper\Enum\BaseEnum;
|
|
|
|
/**
|
|
* @method static self first()
|
|
* @method static self second()
|
|
* @method static self third()
|
|
* @method static self fourth()
|
|
*/
|
|
final class AdviceTimeEnum extends BaseEnum
|
|
{
|
|
/**
|
|
* Enum values
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function values(): array
|
|
{
|
|
return [
|
|
'first' => 1,
|
|
'second' => 2,
|
|
'third' => 3,
|
|
'fourth' => 4,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Enum labels
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function labels(): array
|
|
{
|
|
return [
|
|
'first' => trans('0 - 30min'),
|
|
'second' => trans('31min - 2h'),
|
|
'third' => trans('2h - 4h'),
|
|
'fourth' => trans('> 4h'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Enum times
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function times(): array
|
|
{
|
|
return [
|
|
'first' => [0, 30],
|
|
'second' => [31, 120],
|
|
'third' => [120, 240],
|
|
'fourth' => [240, 1440]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param string $attribute
|
|
* @return integer|string
|
|
*/
|
|
public function __get(string $attribute)
|
|
{
|
|
if ($attribute === 'times') {
|
|
return $this->times()[$this->getDefinition()] ?? null;
|
|
}
|
|
return parent::__get($attribute);
|
|
}
|
|
}
|