Example #1
0
    protected function onYearDays(\DateTime $dateTime)
    {
        if (!$this->yearDays->count()) return true;

        $doty = new DayOfTheYear();
        while ($this->yearDays->next()) {
            if ($doty->setDay($this->yearDays->current())->contains($dateTime))
                return true;
        }

        return false;
    }
Example #2
0
 /**
  * Whether the $datetime is
  *
  * @param DateTime $dateTime
  *
  * @return boolean
  */
 protected function onYearDays(DateTime $dateTime)
 {
     $isOnDay = false;
     if (!$this->yearDays->count()) {
         $isOnDay = true;
     }
     foreach ($this->yearDays as $day) {
         $doty = new DayOfTheYear($day);
         if ($doty->contains($dateTime)) {
             $isOnDay = true;
         }
     }
     return $isOnDay;
 }
 /**
  * @dataProvider getContainsData
  *
  * @param boolean $isValid Whether it is expected to be valid
  * @param string  $date    The date to test
  * @param integer $day     The day to test
  */
 public function testDayOfTheYearContains($isValid, $date, $day)
 {
     $doty = new DayOfTheYear($day);
     $date = \DateTime::createFromFormat('Y-m-d H:i:s', $date);
     $this->assertEquals($isValid, $doty->contains($date));
 }