src/TimeOverlapCalculator.php
private function fetchNonOverlappedTimeSlots(
        TimeSlotInterface $baseTimeSlot,
        TimeSlotInterface $overlappingTimeSlot,
        TimeSlotGeneratorInterface $timeSlotGenerator
    ) {
        $freeTimeSlots = [];

        if ($this->isOverlap($baseTimeSlot, $overlappingTimeSlot)) {
            if ($overlappingTimeSlot->getStart() > $baseTimeSlot->getStart()
                && $overlappingTimeSlot->getStart() < $baseTimeSlot->getEnd()
            ) {
                $freeTimeSlots[] = $timeSlotGenerator->createTimeSlot(
                    clone $baseTimeSlot->getStart(),
                    clone $overlappingTimeSlot->getStart()
                );
            }

            if ($overlappingTimeSlot->getEnd() > $baseTimeSlot->getStart()
                && $overlappingTimeSlot->getEnd() < $baseTimeSlot->getEnd()
            ) {
                $freeTimeSlots[] = $timeSlotGenerator->createTimeSlot(
                    clone $overlappingTimeSlot->getEnd(),
                    clone $baseTimeSlot->getEnd()
                );
            }
        } else {
            $freeTimeSlots[] = $timeSlotGenerator->createTimeSlot(
                clone $baseTimeSlot->getStart(),
                clone $baseTimeSlot->getEnd()
            );
        }

        return $freeTimeSlots;
    }
private function fetchNonOverlappedTimeSlots(
        TimeSlotInterface $baseTimeSlot,
        TimeSlotInterface $overlappingTimeSlot,
        TimeSlotGeneratorInterface $timeSlotGenerator
    ) {
        $freeTimeSlots = [];

        if ($this->isOverlap($baseTimeSlot, $overlappingTimeSlot)) {
            if ($overlappingTimeSlot->getStart() > $baseTimeSlot->getStart()
                && $overlappingTimeSlot->getStart() < $baseTimeSlot->getEnd()
            ) {
                $freeTimeSlots[] = $timeSlotGenerator->createTimeSlot(
                    clone $baseTimeSlot->getStart(),
                    clone $overlappingTimeSlot->getStart()
                );
            }

            if ($overlappingTimeSlot->getEnd() > $baseTimeSlot->getStart()
                && $overlappingTimeSlot->getEnd() < $baseTimeSlot->getEnd()
            ) {
                $freeTimeSlots[] = $timeSlotGenerator->createTimeSlot(
                    clone $overlappingTimeSlot->getEnd(),
                    clone $baseTimeSlot->getEnd()
                );
            }
        } else {
            $freeTimeSlots[] = $timeSlotGenerator->createTimeSlot(
                clone $baseTimeSlot->getStart(),
                clone $baseTimeSlot->getEnd()
            );
        }

        return $freeTimeSlots;
    }
@param TimeSlotInterface          $baseTimeSlot
@param TimeSlotInterface          $overlappingTimeSlot
@param TimeSlotGeneratorInterface $timeSlotGenerator

@return array