/** * @covers ::contains * @dataProvider dataContains */ public function testContains($from, $to, $date, $result) { $span = new DateTimeSpan($from, $to); $this->assertSame($result, $span->contains($date)); }
/** * @param DateTimeSpan $span * @param DateTime $start_date * @return DateTimeSpan */ public function extendBusinessDateTimeSpan(DateTimeSpan $span, DateTime $start_date = null) { $from = clone $span->getFrom(); $to = clone $span->getTo(); foreach ($this->dates as $holiday) { if ($start_date and $holiday < $start_date or 5 < $holiday->format('N')) { continue; } if ($holiday <= $from) { $from->modify('+1 weekday'); } if ($holiday <= $to) { $to->modify('+1 weekday'); } } return new DateTimeSpan($from, $to); }