1 | <?php namespace VojtaSvoboda\Reservations\Classes; |
||
12 | class DatesResolver |
||
13 | { |
||
14 | /** |
||
15 | * Returns reserved time slots from non cancelled reservations. |
||
16 | * |
||
17 | * If you have reservations at 13.10.2016 at 11:00 and also at 13:00, both with 2 hours lenght, this method return |
||
18 | * all booked slots - from 09:15 to 14:45 (when you have 15 minutes slot lenght). |
||
19 | * |
||
20 | * ------------ 11:00 ------------- 13:00 -------------- |
||
21 | * |
||
22 | * Because nearest reservation can be done at 09:00 with 2 hours lenghts and next reservation at 15:00. |
||
23 | * |
||
24 | * @param Collection $reservations |
||
25 | * |
||
26 | * @return array |
||
27 | */ |
||
28 | public function getDatesFromReservations(Collection $reservations) |
||
60 | |||
61 | /** |
||
62 | * Get booked interval around the given date. |
||
63 | * |
||
64 | * @param Carbon $date |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function getBoundaryDates($date) |
||
79 | |||
80 | /** |
||
81 | * Get boundary date before reservation date. |
||
82 | * |
||
83 | * @param $date |
||
84 | * @param $length |
||
85 | * |
||
86 | * @return mixed |
||
87 | */ |
||
88 | private function getBoundaryBefore($date, $length) |
||
96 | |||
97 | /** |
||
98 | * Get boundary date after reservation date. |
||
99 | * |
||
100 | * @param $date |
||
101 | * @param $length |
||
102 | * |
||
103 | * @return mixed |
||
104 | */ |
||
105 | private function getBoundaryAfter($date, $length) |
||
113 | |||
114 | private function getDateFormat() |
||
118 | |||
119 | private function getTimeFormat() |
||
123 | |||
124 | private function getInterval() |
||
128 | |||
129 | private function getLength() |
||
133 | } |
||
134 |