Validate a booking request at the boundary
Foundation · practical lab · 20 min · runtime php-cli
Brief
Write validateBooking(array $input): array that returns ['errors' => [...]] when required fields are missing or the end time is not after the start time, and ['data' => [...]] otherwise. Required integer fields: resource_id, start_minute, end_minute.
3 progressive hints are available in the editor.
Public checks
- rejects missing field — expected:
errors present - rejects inverted range — expected:
errors present