Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Dec 28, 2024
1 parent 5542761 commit fbabb20
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Classes/WorkingPeriod.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,16 @@ protected function checkWorkingRangesOverlaps($ranges)
protected function getNextStartTime(WorkingRange $range): ?WorkingTime
{
$currentRangeFound = false;
foreach ($this->ranges as $currentRange) {
return collect($this->ranges)->first(function($currentRange) use ($range, &$currentRangeFound) {
if ($currentRange === $range) {
$currentRangeFound = true;
continue; // Skip the current range
return false; // Skip the current range
}

if ($currentRangeFound) {
return $currentRange->start(); // Return the next range start
return true; // Return the next range start
}
}

return null;
})?->start();
}

public function isEmpty(): bool
Expand Down

0 comments on commit fbabb20

Please sign in to comment.