/** * Returns new DateTime object * * @param mixed time[optional] * @return \DateTime */ public function __invoke($time = null) { if (null === $time) { $time = 'now'; } return DateTimeUtils::normalize($time); }
/** * @param array|string $options * @return bool */ private function isValid($options) { if (is_string($options)) { return true; } if (isset($options['enabled']) && !$options['enabled']) { return false; } if (!empty($options['since']) && DateTimeUtils::normalize($options['since']) > new DateTime('now') || !empty($options['to']) && DateTimeUtils::normalize($options['to']) < new DateTime('now')) { return false; } return true; }
/** * {@inheritDoc} */ public function setTo($date) { $this->to = DateTimeUtils::normalize($date); return $this; }