@@ 387-406 (lines=20) @@ | ||
384 | $nextOpen = $openingHoursForDay->nextOpen(Time::fromDateTime($dateTime)); |
|
385 | $tries = $this->getDayLimit(); |
|
386 | ||
387 | while ($nextOpen === false || $nextOpen->hours() >= 24) { |
|
388 | if (--$tries < 0) { |
|
389 | throw MaximumLimitExceeded::forString( |
|
390 | 'No open date/time found in the next '.$this->getDayLimit().' days,'. |
|
391 | ' use $openingHours->setDayLimit() to increase the limit.' |
|
392 | ); |
|
393 | } |
|
394 | ||
395 | $dateTime = $dateTime |
|
396 | ->modify('+1 day') |
|
397 | ->setTime(0, 0, 0); |
|
398 | ||
399 | if ($this->isOpenAt($dateTime) && ! $openingHoursForDay->isOpenAt(Time::fromString('23:59'))) { |
|
400 | return $dateTime; |
|
401 | } |
|
402 | ||
403 | $openingHoursForDay = $this->forDate($dateTime); |
|
404 | ||
405 | $nextOpen = $openingHoursForDay->nextOpen(Time::fromDateTime($dateTime)); |
|
406 | } |
|
407 | ||
408 | if ($dateTime->format('H:i') === '00:00' && $this->isOpenAt((clone $dateTime)->modify('-1 second'))) { |
|
409 | return $this->nextOpen($dateTime->modify('+1 minute')); |
|
@@ 440-459 (lines=20) @@ | ||
437 | ||
438 | $tries = $this->getDayLimit(); |
|
439 | ||
440 | while ($nextClose === false || $nextClose->hours() >= 24) { |
|
441 | if (--$tries < 0) { |
|
442 | throw MaximumLimitExceeded::forString( |
|
443 | 'No close date/time found in the next '.$this->getDayLimit().' days,'. |
|
444 | ' use $openingHours->setDayLimit() to increase the limit.' |
|
445 | ); |
|
446 | } |
|
447 | ||
448 | $dateTime = $dateTime |
|
449 | ->modify('+1 day') |
|
450 | ->setTime(0, 0, 0); |
|
451 | ||
452 | if ($this->isClosedAt($dateTime) && $openingHoursForDay->isOpenAt(Time::fromString('23:59'))) { |
|
453 | return $dateTime; |
|
454 | } |
|
455 | ||
456 | $openingHoursForDay = $this->forDate($dateTime); |
|
457 | ||
458 | $nextClose = $openingHoursForDay->nextClose(Time::fromDateTime($dateTime)); |
|
459 | } |
|
460 | ||
461 | $nextDateTime = $nextClose->toDateTime(); |
|
462 |