Skip to content

Commit

Permalink
Merge pull request #135 from maogou/patch-1
Browse files Browse the repository at this point in the history
fix: Sequence  intersections func
  • Loading branch information
nyamsprod committed Dec 6, 2023
2 parents 1021964 + c3f97b7 commit b5380bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Sequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ public function intersections(): self

/** @var Period $current */
$isContained = $current->contains($period);
if ($isContained && $isPreviouslyContained) {
if ($isContained && $isPreviouslyContained && !$sequence->contains($current)) {
$sequence->push($current->intersect($period));

return $sequence;
}

if ($current->overlaps($period)) {
if ($current->overlaps($period) && !$sequence->contains($current)) {
$sequence->push($current->intersect($period));
}

Expand Down

0 comments on commit b5380bf

Please sign in to comment.