1 | <?php |
||
11 | abstract class DateTimeUtil implements DayOfWeekInterface |
||
12 | { |
||
13 | /** |
||
14 | * Returns true if the given date time is a Saturday or Sunday. |
||
15 | * |
||
16 | * @param DateTimeInterface $dateTime The date/time object. |
||
17 | * |
||
18 | * @return bool |
||
19 | */ |
||
20 | final public static function isWeekendDay(DateTimeInterface $dateTime) : bool |
||
24 | |||
25 | /** |
||
26 | * Returns true if the given date time is not a Saturday or Sunday. |
||
27 | * |
||
28 | * @param DateTimeInterface $dateTime The date/time object. |
||
29 | * |
||
30 | * @return bool |
||
31 | */ |
||
32 | final public static function isWeekDay(DateTimeInterface $dateTime) : bool |
||
36 | |||
37 | /** |
||
38 | * Returns true if the given dates occur on the same year, month and day. |
||
39 | * |
||
40 | * @param DateTimeInterface $thisDate A date to compare. |
||
41 | * @param DateTimeInterface $thatDate A date to compare. |
||
42 | * |
||
43 | * @return bool |
||
44 | */ |
||
45 | final public static function isSameDay(DateTimeInterface $thisDate, DateTimeInterface $thatDate) : bool |
||
50 | |||
51 | /** |
||
52 | * Indicates whether the given instance of DateTime is within the daylight saving time range for the current time |
||
53 | * zone. |
||
54 | * |
||
55 | * @param DateTimeInterface $dateTime The date/time object. |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | final public static function isDaylightSavings(DateTimeInterface $dateTime) : bool |
||
63 | |||
64 | /** |
||
65 | * Returns true if the given date is between the provided date range. |
||
66 | * |
||
67 | * @param DateTimeInterface $subjectDate The date/time object being checked. |
||
68 | * @param DateTimeInterface $startDate The start date/time object. |
||
69 | * @param DateTimeInterface $endDate The end date/time object. |
||
70 | * |
||
71 | * @return bool |
||
72 | * |
||
73 | * @throws \DomainException Thrown when an invalid date range is provided. |
||
74 | */ |
||
75 | final public static function isInRange( |
||
89 | |||
90 | /** |
||
91 | * Returns the given DateTime instance as a "time ago" string. |
||
92 | * |
||
93 | * @param DateTimeInterface $dateTime The DateTime object to present as an ago string. |
||
94 | * |
||
95 | * @return string |
||
96 | * |
||
97 | * @throws \DomainException Thrown if the given $dateTime is in the future. |
||
98 | */ |
||
99 | final public static function asAgoString(DateTimeInterface $dateTime) : string |
||
128 | } |
||
129 |