コード例 #1
0
ファイル: DateRange.php プロジェクト: suzuki86/DateRange
 /**
  * Merge two DateRange objects into one DateRange object.
  *
  * @param DateRange $dateRange Daterange object to merge.
  * @return DateRange DateRange object that is merged.
  */
 public function merge(DateRange $dateRange)
 {
     $dateRange1 = $this->extract();
     $dateRange2 = $dateRange->extract();
     $resultDateRange = array_unique(array_merge($dateRange1, $dateRange2), SORT_NUMERIC);
     return new DateRange(min($resultDateRange), max($resultDateRange));
 }