|
- <?php
-
- namespace Lc\ShopBundle\Services;
-
- class Utils
- {
- protected $unitsArray = [
- 'piece' => [
- 'unit' => 'piece',
- 'wording_unit' => 'la pièce',
- 'wording' => 'pièce(s)',
- 'wording_short' => 'p.',
- 'coefficient' => 1,
- 'ref' => 'piece'
- ],
- 'g' => [
- 'unit' => 'g',
- 'wording_unit' => 'le g',
- 'wording' => 'g',
- 'wording_short' => 'g',
- 'coefficient' => 1000,
- 'ref' => 'kg'
- ],
- 'kg' => [
- 'unit' => 'kg',
- 'wording_unit' => 'le kg',
- 'wording' => 'kg',
- 'wording_short' => 'kg',
- 'coefficient' => 1,
- 'ref' => 'kg'
- ],
- 'mL' => [
- 'unit' => 'mL',
- 'wording_unit' => 'le mL',
- 'wording' => 'mL',
- 'wording_short' => 'mL',
- 'coefficient' => 1000,
- 'ref' => 'L'
- ],
- 'cL' => [
- 'unit' => 'cL',
- 'wording_unit' => 'le cL',
- 'wording' => 'cL',
- 'wording_short' => 'cL',
- 'coefficient' => 100,
- 'ref' => 'L'
- ],
- 'L' => [
- 'unit' => 'L',
- 'wording_unit' => 'le litre',
- 'wording' => 'L',
- 'wording_short' => 'L',
- 'coefficient' => 1,
- 'ref' => 'L'
- ],
- ];
-
- public static function getDayByNumber($number)
- {
- $daysArray = [
- 1 => 'Lundu',
- 2 => 'Mardi',
- 3 => 'Mercredi',
- 4 => 'Jeudi',
- 5 => 'Vendredi',
- 6 => 'Samedi',
- 7 => 'Dimanche'
- ] ;
-
- if(isset($daysArray[$number])) {
- return $daysArray[$number] ;
- }
-
- return '' ;
- }
-
- public function getUnitsListFormatedForType(){
- foreach ($this->unitsArray as $unit=>$unitInfo){
- $choices[$unitInfo['wording_unit']] = $unit;
- };
- return $choices;
- }
- public function getUnitsList(){
- return $this->unitsArray;
- }
-
-
-
-
- }
|