/** * Check if an interval array is all day. * * @param Time $start The start time. * @param Time $end The end time. * @return boolean */ private static function isIntervalAllDay(Time $start, Time $end) { if ($start->getHours() !== 0 || $start->getMinutes() !== 0 || $start->getSeconds() !== 0) { return false; } if ($end->getHours() !== 24 || $end->getMinutes() !== 0 || $end->getSeconds() !== 0) { return false; } return true; }
/** * {@inheritdoc} */ public function getNextOpeningHoursInterval(Time $time) { $closestTime = null; $closestInterval = null; foreach ($this->openingHoursIntervals as $interval) { $distance = $interval->getStart()->toSeconds() - $time->toSeconds(); if ($distance < 0) { continue; } if (null === $closestTime) { $closestTime = $interval->getStart(); $closestInterval = $interval; } if ($distance < $closestTime->toSeconds() - $time->toSeconds()) { $closestTime = $interval->getStart(); $closestInterval = $interval; } } return $closestInterval; }