1 | <?php |
||
23 | class TimeSlotHelper { |
||
24 | |||
25 | /** |
||
26 | * Determines if a time slot A contains a time slot b. |
||
27 | * |
||
28 | * @param TimeSlot $a The time slot A. |
||
29 | * @param TimeSlot $b The time slot B. |
||
30 | * @return bool Returns true in case of success, false otherwise. |
||
31 | */ |
||
32 | public static function contains(TimeSlot $a, TimeSlot $b): bool { |
||
37 | |||
38 | /** |
||
39 | * Determines if two time slots are equals. |
||
40 | * |
||
41 | * @param TimeSlot $a The time slot A. |
||
42 | * @param TimeSlot $b The time slot B. |
||
43 | * @return bool Returns true in case of success, false otherwise. |
||
44 | */ |
||
45 | public static function equals(TimeSlot $a, TimeSlot $b): bool { |
||
67 | |||
68 | /** |
||
69 | * Full join two time slots. |
||
70 | * |
||
71 | * @param TimeSlot $a The time slot A. |
||
72 | * @param TimeSlot $b The time slot B. |
||
73 | * @return TimeSlot|null Returns a time slot in case of success, null otherwise. |
||
74 | */ |
||
75 | public static function fullJoin(TimeSlot $a, TimeSlot $b): ?TimeSlot { |
||
86 | |||
87 | /** |
||
88 | * Full join two time slots without time slots intersection. |
||
89 | * |
||
90 | * @param TimeSlot $a The time slot A. |
||
91 | * @param TimeSlot $b The time slot B. |
||
92 | * @return TimeSlot[]|null Returns the time slots in case of success, null otherwise. |
||
93 | */ |
||
94 | public static function fullJoinWithout(TimeSlot $a, TimeSlot $b): ?array { |
||
111 | |||
112 | /** |
||
113 | * Get the duration. |
||
114 | * |
||
115 | * @param TimeSlot[] $timeSlots the time slots. |
||
116 | * @return int Returns the duration. |
||
117 | */ |
||
118 | public static function getDuration(array $timeSlots): int { |
||
128 | |||
129 | /** |
||
130 | * Determines if a time slot A has full join with time slot B. |
||
131 | * |
||
132 | * @param TimeSlot $a The time slot A. |
||
133 | * @param TimeSlot $b The time slot B. |
||
134 | * @return bool Returns true in case of success, false otherwise. |
||
135 | */ |
||
136 | public static function hasFullJoin(TimeSlot $a, TimeSlot $b): bool { |
||
139 | |||
140 | /** |
||
141 | * Determines if a time slot A has an inner join with time slot B. |
||
142 | * |
||
143 | * @param TimeSlot $a The time slot A. |
||
144 | * @param TimeSlot $b The time slot B. |
||
145 | * @return bool Returns true in case of success, false otherwise. |
||
146 | */ |
||
147 | public static function hasInnerJoin(TimeSlot $a, TimeSlot $b): bool { |
||
154 | |||
155 | /** |
||
156 | * Inner join two time slots. |
||
157 | * |
||
158 | * @param TimeSlot $a The time slot A. |
||
159 | * @param TimeSlot $b The time slot B. |
||
160 | * @return TimeSlot|null Returns a time slot in case of success, null otherwise. |
||
161 | */ |
||
162 | public static function innerJoin(TimeSlot $a, TimeSlot $b): ?TimeSlot { |
||
173 | |||
174 | /** |
||
175 | * Left join two time slots. |
||
176 | * |
||
177 | * @param TimeSlot $a The time slot A. |
||
178 | * @param TimeSlot $b The time slot B. |
||
179 | * @return TimeSlot|null Returns the time slot in case of success, null otherwise. |
||
180 | */ |
||
181 | public static function leftJoin(TimeSlot $a, TimeSlot $b): ?TimeSlot { |
||
189 | |||
190 | /** |
||
191 | * Left join two time slots without time slot B intersection. |
||
192 | * |
||
193 | * @param TimeSlot $a The time slot A. |
||
194 | * @param TimeSlot $b The time slot B. |
||
195 | * @return TimeSlot[]|null Returns the time slots in case of success, null otherwise. |
||
196 | */ |
||
197 | public static function leftJoinWithout(TimeSlot $a, TimeSlot $b): ?array { |
||
217 | |||
218 | /** |
||
219 | * Merge. |
||
220 | * |
||
221 | * @param TimeSlot[] $timeSlots The time slots. |
||
222 | * @return TimeSlot[] Returns the merged time slots. |
||
223 | */ |
||
224 | public static function merge(array $timeSlots): array { |
||
250 | |||
251 | /** |
||
252 | * Right join two time slots. |
||
253 | * |
||
254 | * @param TimeSlot $a The time slot A. |
||
255 | * @param TimeSlot $b The time slot B. |
||
256 | * @return TimeSlot|null Returns the time slot in case of success, null otherwise. |
||
257 | */ |
||
258 | public static function rightJoin(TimeSlot $a, TimeSlot $b): ?TimeSlot { |
||
261 | |||
262 | /** |
||
263 | * Right join two time slots without time slot B intersection. |
||
264 | * |
||
265 | * @param TimeSlot $a The time slot A. |
||
266 | * @param TimeSlot $b The time slot B. |
||
267 | * @return TimeSlot[]|null Returns the time slots in case of success, null otherwise. |
||
268 | */ |
||
269 | public static function rightJoinWithout(TimeSlot $a, TimeSlot $b): ?array { |
||
272 | |||
273 | /** |
||
274 | * Sort time slots. |
||
275 | * |
||
276 | * @param TimeSlot[] $timeSlots The time slots. |
||
277 | * @return TimeSlot[] Returns the sorted time slots. |
||
278 | */ |
||
279 | public static function sort(array $timeSlots): array { |
||
286 | } |
||
287 |