|
- <?php
-
- namespace common\components;
-
- class Date
- {
- public static function getDaysOfWeekArray(bool $withNullValue = false): array
- {
- $daysOfWeekArray = [];
-
- if($withNullValue) {
- $daysOfWeekArray[null] = '--';
- }
-
- $daysOfWeekArray = $daysOfWeekArray +
- [
- 1 => 'Lundi',
- 2 => 'Mardi',
- 3 => 'Mercredi',
- 4 => 'Jeudi',
- 5 => 'Vendredi',
- 6 => 'Samedi',
- 7 => 'Dimanche'
- ];
-
- return $daysOfWeekArray;
- }
-
- public static function getDayOfWeekStringByNumber(int $dayOfWeekNumber): string
- {
- $daysOfWeekArray = self::getDaysOfWeekArray();
- return $daysOfWeekArray[$dayOfWeekNumber];
- }
- }
|