Skip to content

Commit

Permalink
clean(ZMSKVR): format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fink authored and Thomas Fink committed Feb 21, 2025
1 parent e10c7d7 commit 2575ed8
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,16 @@ public static function getAvailableAppointments(string $date, array $officeIds,
return new AvailableAppointments(array_values($timestamps)[0]);
}

private static function processFreeSlots(ProcessList $freeSlots): array {
private static function processFreeSlots(ProcessList $freeSlots): array
{
$errors = ValidationService::validateGetProcessFreeSlots($freeSlots);
if (is_array($errors) && !empty($errors['errors'])) {
return $errors;
}

$currentTimestamp = time();
$allTimestamps = [];

// Collect all timestamps
foreach ($freeSlots as $slot) {
if (isset($slot->appointments) && is_iterable($slot->appointments)) {
Expand All @@ -502,16 +503,16 @@ private static function processFreeSlots(ProcessList $freeSlots): array {
}
}
}

// Final deduplication and sorting
$uniqueTimestamps = array_values(array_unique($allTimestamps));
sort($uniqueTimestamps);

$errors = ValidationService::validateGetProcessByIdTimestamps($uniqueTimestamps);
if (is_array($errors) && !empty($errors['errors'])) {
return $errors;
}

return ['appointmentTimestamps' => $uniqueTimestamps];
}

Expand Down

0 comments on commit 2575ed8

Please sign in to comment.