ldc-lionor/app/Enums/CookingModeEnum.php
Sebastien Hattry 331be4ca79 Integration 3
2023-03-10 15:33:15 +00:00

75 lines
1.6 KiB
PHP

<?php
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
/**
* @method static self withoutCooking()
* Sans cuisson
* @method static self oven()
* Au four
* @method static self stove()
* A la poele
* @method static self stewpan()
* En cocotte
*/
final class CookingModeEnum extends BaseEnum
{
/**
* Enum values
*
* @return array
*/
protected static function values(): array
{
return [
'withoutCooking' => 0,
'oven' => 1,
'stove' => 2,
'stewpan' => 3
];
}
/**
* Enum labels
*
* @return array
*/
protected static function labels(): array
{
return [
'withoutCooking' => trans('Sans cuisson'),
'oven' => trans('Au four'),
'stove' => trans('A la poële'),
'stewpan' => trans('En cocotte'),
];
}
/**
* Enum stickers associés
*
* @return array
*/
protected static function stickers(): array
{
return [
'withoutCooking' => \asset('build/assets/images/cook/logo-stove.svg'),
'oven' => \asset('build/assets/images/cook/logo-stove.svg'),
'stove' => \asset('build/assets/images/cook/logo-stove.svg'),
'stewpan' => \asset('build/assets/images/cook/logo-stove.svg'),
];
}
/**
* @param string $attribute
* @return integer|string
*/
public function __get(string $attribute)
{
if ($attribute === 'sticker') {
return $this->stickers()[$this->getDefinition()] ?? null;
}
return parent::__get($attribute);
}
}