@@ 373-392 (lines=20) @@ | ||
370 | $nextOpen = $openingHoursForDay->nextOpen(Time::fromDateTime($dateTime)); |
|
371 | $tries = $this->getDayLimit(); |
|
372 | ||
373 | while ($nextOpen === false || $nextOpen->hours() >= 24) { |
|
374 | if (--$tries < 0) { |
|
375 | throw MaximumLimitExceeded::forString( |
|
376 | 'No open date/time found in the next '.$this->getDayLimit().' days,'. |
|
377 | ' use $openingHours->setDayLimit() to increase the limit.' |
|
378 | ); |
|
379 | } |
|
380 | ||
381 | $dateTime = $dateTime |
|
382 | ->modify('+1 day') |
|
383 | ->setTime(0, 0, 0); |
|
384 | ||
385 | if ($this->isOpenAt($dateTime) && ! $openingHoursForDay->isOpenAt(Time::fromString('23:59'))) { |
|
386 | return $dateTime; |
|
387 | } |
|
388 | ||
389 | $openingHoursForDay = $this->forDate($dateTime); |
|
390 | ||
391 | $nextOpen = $openingHoursForDay->nextOpen(Time::fromDateTime($dateTime)); |
|
392 | } |
|
393 | ||
394 | if ($dateTime->format('H:i') === '00:00' && $this->isOpenAt((clone $dateTime)->modify('-1 second'))) { |
|
395 | return $this->nextOpen($dateTime->modify('+1 minute')); |
|
@@ 426-445 (lines=20) @@ | ||
423 | ||
424 | $tries = $this->getDayLimit(); |
|
425 | ||
426 | while ($nextClose === false || $nextClose->hours() >= 24) { |
|
427 | if (--$tries < 0) { |
|
428 | throw MaximumLimitExceeded::forString( |
|
429 | 'No close date/time found in the next '.$this->getDayLimit().' days,'. |
|
430 | ' use $openingHours->setDayLimit() to increase the limit.' |
|
431 | ); |
|
432 | } |
|
433 | ||
434 | $dateTime = $dateTime |
|
435 | ->modify('+1 day') |
|
436 | ->setTime(0, 0, 0); |
|
437 | ||
438 | if ($this->isClosedAt($dateTime) && $openingHoursForDay->isOpenAt(Time::fromString('23:59'))) { |
|
439 | return $dateTime; |
|
440 | } |
|
441 | ||
442 | $openingHoursForDay = $this->forDate($dateTime); |
|
443 | ||
444 | $nextClose = $openingHoursForDay->nextClose(Time::fromDateTime($dateTime)); |
|
445 | } |
|
446 | ||
447 | $nextDateTime = $nextClose->toDateTime(); |
|
448 |