Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return null;
     }
     return DayOfWeek::of($value);
 }
Beispiel #2
0
 /**
  * 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);
 }
Beispiel #3
0
 /**
  * @return DayOfWeek
  */
 public function getDayOfWeek()
 {
     return DayOfWeek::of(Math::floorMod($this->toEpochDay() + 3, 7) + 1);
 }
Beispiel #4
0
 /**
  * @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));
 }
Beispiel #5
0
 /**
  * @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()]);
 }