Skip to content

Commit

Permalink
Convert IntervalDataSets into ordinary IntervalSets
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoiq committed Feb 12, 2020
1 parent 312c719 commit 86a2a14
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Time/IntervalData/DateIntervalDataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ public function poke(): void
}
}

public function toDateIntervalSet(): DateIntervalSet
{
$intervals = [];
/** @var \Dogma\Time\IntervalData\DateIntervalData $interval */
foreach ($this->intervals as $interval) {
$intervals[] = $interval->toDateInterval();
}

return new DateIntervalSet($intervals);
}

/**
* @return \Dogma\Time\Date[][]|mixed[][] array of pairs: (Date $date, Equalable $data)
*/
Expand Down
11 changes: 11 additions & 0 deletions src/Time/IntervalData/NightIntervalDataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ public function poke(): void
}
}

public function toNightIntervalSet(): NightIntervalSet
{
$intervals = [];
/** @var \Dogma\Time\IntervalData\NightIntervalData $interval */
foreach ($this->intervals as $interval) {
$intervals[] = $interval->toDateInterval();
}

return new NightIntervalSet($intervals);
}

/**
* @return \Dogma\Time\Date[][]|mixed[][] array of pairs: (Date $date, Equalable $data)
*/
Expand Down

0 comments on commit 86a2a14

Please sign in to comment.