Ejemplo n.º 1
0
 public function getDateFor($year)
 {
     $shift = sprintf('%s days', $this->add);
     $dateTime = $this->date->getDateFor($year)->toDateTimeObject();
     $dateTime->modify($shift);
     return new HolidayData($dateTime->format('d'), $dateTime->format('m'), $dateTime->format('Y'));
 }
Ejemplo n.º 2
0
 /**
  * Calculates one day for provided year
  *
  * @param Calculable $date
  * @param string $name
  * @param int $year
  * @return $this
  */
 protected function calculateDay(Calculable $date, $name, $year)
 {
     $holidayData = $date->getDateFor($year);
     // set holiday name
     $holidayData->setName($name);
     // add holiday to days collection so we can easier get that holiday by date
     $this->days->add($holidayData);
     // add holiday to names collection so we can easier get that holiday by name
     $this->names->add($holidayData);
     return $this;
 }