You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 satır
2.8KB

  1. <?php
  2. namespace Lc\ShopBundle\Services;
  3. class Utils
  4. {
  5. protected $unitsArray = [
  6. 'piece' => [
  7. 'unit' => 'piece',
  8. 'wording_unit' => 'la pièce',
  9. 'wording' => 'pièce(s)',
  10. 'wording_short' => 'p.',
  11. 'coefficient' => 1,
  12. 'ref' => 'piece'
  13. ],
  14. 'g' => [
  15. 'unit' => 'g',
  16. 'wording_unit' => 'le g',
  17. 'wording' => 'g',
  18. 'wording_short' => 'g',
  19. 'coefficient' => 1000,
  20. 'ref' => 'kg'
  21. ],
  22. 'kg' => [
  23. 'unit' => 'kg',
  24. 'wording_unit' => 'le kg',
  25. 'wording' => 'kg',
  26. 'wording_short' => 'kg',
  27. 'coefficient' => 1,
  28. 'ref' => 'kg'
  29. ],
  30. 'mL' => [
  31. 'unit' => 'mL',
  32. 'wording_unit' => 'le mL',
  33. 'wording' => 'mL',
  34. 'wording_short' => 'mL',
  35. 'coefficient' => 1000,
  36. 'ref' => 'L'
  37. ],
  38. 'cL' => [
  39. 'unit' => 'cL',
  40. 'wording_unit' => 'le cL',
  41. 'wording' => 'cL',
  42. 'wording_short' => 'cL',
  43. 'coefficient' => 100,
  44. 'ref' => 'L'
  45. ],
  46. 'L' => [
  47. 'unit' => 'L',
  48. 'wording_unit' => 'le litre',
  49. 'wording' => 'L',
  50. 'wording_short' => 'L',
  51. 'coefficient' => 1,
  52. 'ref' => 'L'
  53. ],
  54. ];
  55. public static function getDayByNumber($number)
  56. {
  57. $daysArray = [
  58. 1 => 'Lundu',
  59. 2 => 'Mardi',
  60. 3 => 'Mercredi',
  61. 4 => 'Jeudi',
  62. 5 => 'Vendredi',
  63. 6 => 'Samedi',
  64. 7 => 'Dimanche'
  65. ] ;
  66. if(isset($daysArray[$number])) {
  67. return $daysArray[$number] ;
  68. }
  69. return '' ;
  70. }
  71. public function getUnitsListFormatedForType(){
  72. foreach ($this->unitsArray as $unit=>$unitInfo){
  73. $choices[$unitInfo['wording_unit']] = $unit;
  74. };
  75. return $choices;
  76. }
  77. public function getUnitsList(){
  78. return $this->unitsArray;
  79. }
  80. }