/** * @param Date $date * @param Time $time */ public function __construct(Date $date, Time $time) { $this->date = $date; $this->time = $time; $this->timestamp = (int) $date->getTimestamp() + (int) $time->getTimestamp(); $this->native = self::getDateTime($date . ' ' . $time); parent::__construct([$date, $time]); }
/** * @param Year $year * @param Month $month * @param Day $day */ public function __construct(Year $year, Month $month, Day $day) { $this->year = $year; $this->month = $month; $this->day = $day; $this->native = new \DateTime($year . '-' . $month . '-' . $day); $this->timestamp = $this->native->getTimeStamp(); parent::__construct([$year, $month, $day]); }
/** * @param Hour $hour * @param Minute $minute * @param Second $second */ public function __construct(Hour $hour, Minute $minute, Second $second) { $this->hour = $hour; $this->minute = $minute; $this->second = $second; $this->timestamp = $hour->getSeconds()->add($minute->getSeconds())->add($second); $this->native = self::getNowDateTime()->setTime($hour->getValue(), $minute->getValue(), $minute->getValue()); parent::__construct(func_get_args()); }