ldc-lionor/app/Enums/SignsEnum.php

93 lines
2.1 KiB
PHP

<?php
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnum;
/**
* @method static self leclerc()
* Leclerc
* @method static self auchan()
* Auchan
* @method static self carrefour()
* Carrefour
* @method static self match()
* Match
* @method static self intermarche()
* Intermarche
* @method static self cora()
* Cora
*/
final class SignsEnum extends BaseEnum
{
/**
* Enum values
*
* @return array
*/
protected static function values(): array
{
return [
'leclerc' => 1,
'auchan' => 2,
'carrefour' => 3,
'match' => 4,
'intermarche' => 5,
'cora' => 6,
];
}
/**
* Enum labels
*
* @return array
*/
protected static function labels(): array
{
return [
'leclerc' => 'Leclerc',
'auchan' => 'Auchan',
'carrefour' => 'Carrefour',
'match' => 'Match',
'intermarche' => 'Intermarché',
'cora' => 'Cora',
];
}
/**
* Enum stickers associés
*
* @return array
*/
protected static function stickers(): array
{
return [
'leclerc' => \asset('build/assets/images/signs/logo-leclerc.png'),
'auchan' => \asset('build/assets/images/signs/logo-auchan.jpg'),
'carrefour' => \asset('build/assets/images/signs/logo-carrefour.jpg'),
'match' => \asset('build/assets/images/signs/logo-match.png'),
'intermarche' => \asset('build/assets/images/signs/logo-intermarche.png'),
'cora' => \asset('build/assets/images/signs/logo-cora.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());
}
}