88 lines
2 KiB
PHP
88 lines
2 KiB
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Kwaadpepper\Enum\BaseEnum;
|
|
|
|
/**
|
|
* @method static self pasDenseigne()
|
|
* Pas d'enseigne
|
|
* @method static self leclerc()
|
|
* Enseigne Leclerc
|
|
* @method static self systemeU()
|
|
* Enseigne Système U
|
|
* @method static self carrefour()
|
|
* Enseigne Carrefour
|
|
* @method static self auchan()
|
|
* Enseigne Auchan
|
|
*/
|
|
final class SignsEnum extends BaseEnum
|
|
{
|
|
/**
|
|
* Enum values
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function values(): array
|
|
{
|
|
return [
|
|
'pasDenseigne' => 0,
|
|
'leclerc' => 1,
|
|
'systemeU' => 2,
|
|
'carrefour' => 3,
|
|
'auchan' => 4,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Enum labels
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function labels(): array
|
|
{
|
|
return [
|
|
'pasDenseigne' => 'Pas d\'enseigne',
|
|
'leclerc' => 'Leclerc',
|
|
'systemeU' => 'Système U',
|
|
'carrefour' => 'Carrefour',
|
|
'auchan' => 'Auchan',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Enum stickers associés
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function stickers(): array
|
|
{
|
|
return [
|
|
'pasDenseigne' => \asset('build/assets/images/signs/logo-default.png'),
|
|
'leclerc' => \asset('build/assets/images/signs/logo-leclerc.png'),
|
|
'systemeU' => \asset('build/assets/images/signs/logo-systemeu.png'),
|
|
'carrefour' => \asset('build/assets/images/signs/logo-carrefour.png'),
|
|
'auchan' => \asset('build/assets/images/signs/logo-auchan.png'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param string $attribute
|
|
* @return integer|string
|
|
*/
|
|
public function __get(string $attribute)
|
|
{
|
|
if ($attribute === 'sticker') {
|
|
return $this->stickers()[$this->getDefinition()] ?? null;
|
|
}
|
|
return parent::__get($attribute);
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public static function getStickers()
|
|
{
|
|
return array_values(static::stickers());
|
|
}
|
|
}
|