1 | <?php |
||
24 | final class DateUtility implements DateUtilityInterface { |
||
25 | |||
26 | /** |
||
27 | * Get a day number. |
||
28 | * |
||
29 | * @param DateTime $date The date. |
||
30 | * @return integer Returns the day number between 1 and 7 with monday equals to 1. |
||
31 | */ |
||
32 | public static function getDayNumber(DateTime $date) { |
||
35 | |||
36 | /** |
||
37 | * Get a week number. |
||
38 | * |
||
39 | * @param DateTime $date The date. |
||
40 | * @return integer Returns the week number. |
||
41 | */ |
||
42 | public static function getWeekNumber(DateTime $date) { |
||
45 | |||
46 | /** |
||
47 | * Get a week number to apply with a schedule. |
||
48 | * |
||
49 | * <p> |
||
50 | * For example: |
||
51 | * We have a schedule etablished over 5 weeks. |
||
52 | * |
||
53 | * We start the schedule with the week number 1. |
||
54 | * If the current date is 2018-01-01 and the start date is 2018-01-01, the week number is 1 |
||
55 | * If the current date is 2018-01-08 and the start date is 2018-01-01, the week number is 2 |
||
56 | * etc. |
||
57 | * |
||
58 | * We start the schedule with the week number 3. |
||
59 | * If the current date is 2018-01-01 and the start date is 2018-01-01, the week number is 3 |
||
60 | * If the current date is 2018-01-08 and the start date is 2018-01-01, the week number is 4 |
||
61 | * etc. |
||
62 | * </p> |
||
63 | * |
||
64 | * @param DateTime $date The date. |
||
65 | * @param DateTime $startDate The start date. |
||
66 | * @param integer $weekCount The week count. |
||
67 | * @param integer $weekNumber The week number. |
||
68 | * @return integer Returns the week number to apply between 1 and $weekCount. |
||
69 | */ |
||
70 | public static function getWeekNumberToApply(DateTime $date, DateTime $startDate, $weekCount, $weekNumber) { |
||
80 | |||
81 | /** |
||
82 | * Get the weekday into FR. |
||
83 | * |
||
84 | * @return array Returns the weekday into FR. |
||
85 | */ |
||
86 | public static function getWeekdayFR() { |
||
97 | |||
98 | /** |
||
99 | * Translate the weekday part. |
||
100 | * |
||
101 | * @param string $date The date. |
||
102 | * @param array $translations The translations: day => translation. |
||
103 | * @return string Returns the weekday part translated. |
||
104 | */ |
||
105 | public static function translateWeekday($date, array $translations = []) { |
||
108 | |||
109 | } |
||
110 |