1 | <?php namespace VojtaSvoboda\Reservations\Facades; |
||
25 | class ReservationsFacade |
||
26 | { |
||
27 | /** @var Reservation $reservations */ |
||
28 | private $reservations; |
||
29 | |||
30 | /** @var Status $statuses */ |
||
31 | private $statuses; |
||
32 | |||
33 | /** @var DatesResolver $datesResolver */ |
||
34 | private $datesResolver; |
||
35 | |||
36 | /** @var array $returningUsersCache */ |
||
37 | private $returningUsersCache; |
||
38 | |||
39 | /** |
||
40 | * ReservationsFacade constructor. |
||
41 | * |
||
42 | * @param Reservation $reservations |
||
43 | * @param Status $statuses |
||
44 | * @param DatesResolver $resolver |
||
45 | */ |
||
46 | 9 | public function __construct(Reservation $reservations, Status $statuses, DatesResolver $resolver) |
|
52 | |||
53 | /** |
||
54 | * Create and store reservation. |
||
55 | * |
||
56 | * @param array $data |
||
57 | * |
||
58 | * @return Reservation $reservation |
||
59 | * |
||
60 | * @throws ApplicationException |
||
61 | * @throws ValidationException |
||
62 | */ |
||
63 | 8 | public function storeReservation($data) |
|
82 | |||
83 | /** |
||
84 | * Get all reservations. |
||
85 | * |
||
86 | * @return Collection |
||
87 | */ |
||
88 | public function getReservations() |
||
92 | |||
93 | /** |
||
94 | * Get all active (not cancelled) reservations. |
||
95 | * |
||
96 | * @return Collection |
||
97 | */ |
||
98 | public function getActiveReservations() |
||
102 | |||
103 | /** |
||
104 | * Get all reserved time slots. |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | public function getReservedDates() |
||
114 | |||
115 | /** |
||
116 | * Get all reservations by given date interval. |
||
117 | * |
||
118 | * @param Carbon $since Date from. |
||
119 | * @param Carbon $till Date to. |
||
120 | * |
||
121 | * @return mixed |
||
122 | */ |
||
123 | public function getReservationsByInterval(Carbon $since, Carbon $till) |
||
127 | |||
128 | /** |
||
129 | * Get reservations count by one email. |
||
130 | * |
||
131 | * @param $email |
||
132 | * |
||
133 | * @return int |
||
134 | */ |
||
135 | 1 | public function getReservationsWithSameEmailCount($email) |
|
139 | |||
140 | /** |
||
141 | * Is user returning or not? You have to set this parameter at Backend Reservations setting. |
||
142 | * |
||
143 | * @param $email |
||
144 | * |
||
145 | * @return bool |
||
146 | */ |
||
147 | 1 | public function isUserReturning($email) |
|
173 | |||
174 | /** |
||
175 | * Bulk reservation state change. |
||
176 | * |
||
177 | * @param array $ids |
||
178 | * @param string $ident |
||
179 | */ |
||
180 | public function bulkStateChange($ids, $ident) |
||
200 | |||
201 | /** |
||
202 | * Bulk reservations delete. |
||
203 | * |
||
204 | * @param array $ids |
||
205 | */ |
||
206 | public function bulkDelete($ids) |
||
219 | |||
220 | /** |
||
221 | * Transform date and time to DateTime string. |
||
222 | * |
||
223 | * @param $data |
||
224 | * |
||
225 | * @return Carbon |
||
226 | * |
||
227 | * @throws ApplicationException |
||
228 | */ |
||
229 | 9 | public function transformDateTime($data) |
|
243 | |||
244 | /** |
||
245 | * Check gived date and time. |
||
246 | * |
||
247 | * @param array $data |
||
248 | * |
||
249 | * @throws ApplicationException |
||
250 | */ |
||
251 | 6 | public function checkDate($data) |
|
263 | |||
264 | /** |
||
265 | * Returns if date is available to book. |
||
266 | * |
||
267 | * @param Carbon $date |
||
268 | * |
||
269 | * @return bool |
||
270 | */ |
||
271 | 6 | public function isDateAvailable(Carbon $date) |
|
291 | |||
292 | /** |
||
293 | * Try to find some reservation in less then half minute. |
||
294 | * |
||
295 | * @return boolean |
||
296 | */ |
||
297 | 6 | public function isSomeReservationExistsInLastTime() |
|
301 | } |
||
302 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.