/** * Returns the days in this week. * * @return Day[] */ public function days() { if (!isset($this->days)) { $clonedStart = clone $this->weekStart; $this->days = array(); for ($i = 0; $i < 7; $i++) { $thisDay = new Day($clonedStart); if ($this->containingMonth && $this->containingMonth->firstDay()->format('m') != $clonedStart->format('m')) { $thisDay->setIsOverflow(true); } $this->days[] = $thisDay; $clonedStart->modify('+1 day'); } } return $this->days; }
public function testTimeframeImplementation() { $d = new Day(new DateTime('2014-04-16')); $this->assertEquals('2014-04-16 00:00:00', $d->start()->format('Y-m-d H:i:s')); $this->assertEquals('2014-04-16 23:59:59', $d->end()->format('Y-m-d H:i:s')); }