/** * {@inheritdoc} */ public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } return DayOfWeek::of($value); }
/** * Returns the DayOfWeek that is the specified number of days after this one. * * @param integer $days * * @return DayOfWeek */ public function plus($days) { $days = Cast::toInteger($days); return DayOfWeek::get((($this->value - 1 + $days) % 7 + 7) % 7 + 1); }
/** * @return DayOfWeek */ public function getDayOfWeek() { return DayOfWeek::of(Math::floorMod($this->toEpochDay() + 3, 7) + 1); }
/** * @dataProvider providerToString * * @param integer $dayOfWeek The day-of-week value, from 1 to 7. * @param string $expectedName The expected name. */ public function testToString($dayOfWeek, $expectedName) { $this->assertSame($expectedName, (string) DayOfWeek::of($dayOfWeek)); }
/** * @param integer $dayOfWeekValue The expected day-of-week value, from 1 to 7. * @param DayOfWeek $dayOfWeek The DayOfWeek instance to test. */ protected function assertDayOfWeekIs($dayOfWeekValue, DayOfWeek $dayOfWeek) { $this->compare([$dayOfWeekValue], [$dayOfWeek->getValue()]); }