/**
  * @param string $string
  * @return DateTimeBoundary
  */
 protected static function parseBoundary(string $string) : Boundary
 {
     list($elementString, $state) = self::parseBoundaryDataFromString($string);
     /** @var DateTime $dateTime */
     $dateTime = DateTime::from($elementString);
     return new DateTimeBoundary($dateTime, $state);
 }
 /**
  * @param \DateTime $date
  * @return DateTimeInterval
  */
 protected static function buildWholeDayInterval(\DateTime $date) : DateTimeInterval
 {
     /** @var DateTime $start */
     $start = DateTime::from($date);
     $start->setTime(0, 0, 0);
     /** @var DateTime $ends */
     $ends = DateTime::from($date);
     $ends->setTime(23, 59, 59);
     $thisDayInterval = new DateTimeInterval(new DateTimeBoundary($start, Boundary::CLOSED), new DateTimeBoundary($ends, Boundary::CLOSED));
     return $thisDayInterval;
 }
 /**
  * @param \DateTime|string|int $element
  * @param bool $state
  * @return DateTimeBoundary
  */
 public static function create($element, bool $state) : DateTimeBoundary
 {
     /** @var DateTime $element */
     $element = DateTime::from($element);
     return new DateTimeBoundary($element, $state);
 }
예제 #4
0
 /**
  * @param \DateTime $modified
  */
 private function setFromDateTime(\DateTime $modified)
 {
     $this->setSeconds((double) $modified->format('s'));
     $this->setMinutes((int) $modified->format('i'));
     $this->setHours((int) $modified->format('H'));
 }