Medical Appointments API

ScheduleTimeSlotService
in package

A class service for working with the logic business of schedule time slots.

Tags
author

Luis Graciano contacto@luisgraciano.dev

Table of Contents

$scheduleTimeSlotRepository  : ScheduleTimeSlotRepository
__construct()  : mixed
ScheduleTimeSlotService constructor.
countAppointments()  : int
Count the number of appointments for a schedule time slot.
delete()  : void
Delete a schedule time slot by id.
findById()  : ScheduleTimeSlotDomain
Find a schedule time slot by id.
findByScheduleId()  : array<string|int, ScheduleTimeSlotDomain>
Find all schedule time slots for a schedule.
saveTimeSlots()  : void
Save the schedule time slots.
validateTimeSlots()  : void
Apply business validations to the schedule time slots. If the time slots overlap, an exception is thrown.
checkOverlap()  : bool
Validate if two time slots overlap.
checkOverlaps()  : void
Check if the time slots for a day overlap. If the time slots overlap, an exception is thrown.
mapScheduleTimeSlotEntityToDomain()  : ScheduleTimeSlotDomain
Map a schedule time slot entity to a domain object.

Properties

Methods

countAppointments()

Count the number of appointments for a schedule time slot.

public countAppointments(int $id) : int
Parameters
$id : int

The id of the schedule time slot.

Tags
throws
UnhandledException

If an error occurs while counting the appointments.

Return values
int

delete()

Delete a schedule time slot by id.

public delete(int $id) : void
Parameters
$id : int

The id of the schedule time slot to delete.

Tags
throws
UnhandledException

If an error occurs while deleting the schedule time slot.

Return values
void

findByScheduleId()

Find all schedule time slots for a schedule.

public findByScheduleId(int $scheduleId) : array<string|int, ScheduleTimeSlotDomain>
Parameters
$scheduleId : int

The schedule id to find the schedule time slots.

Tags
throws
UnhandledException

If an error occurs while finding the schedule time slots.

Return values
array<string|int, ScheduleTimeSlotDomain>

An array of schedule time slot domain objects.

checkOverlaps()

Check if the time slots for a day overlap. If the time slots overlap, an exception is thrown.

private checkOverlaps(array<string|int, mixed> $timeSlots) : void
Parameters
$timeSlots : array<string|int, mixed>
Tags
throws
BusinessValidationException

If the time slots overlap.

Return values
void

Search results