public function intersections(): self
    {
        $sequence = new self();
        $current = null;
        $isPreviouslyContained = false;
        foreach ($this->sorted([$this, 'sortByStartDate']) as $period) {
            if (null === $current) {
                $current = $period;
                continue;
            }

            $isContained = $current->contains($period);
            if ($isContained && $isPreviouslyContained) {
                continue;
            }

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

            $isPreviouslyContained = $isContained;
            if (!$isContained) {
                $current = $period;
            }
        }

        return $sequence;
    }
public function intersections(): self
    {
        $sequence = new self();
        $current = null;
        $isPreviouslyContained = false;
        foreach ($this->sorted([$this, 'sortByStartDate']) as $period) {
            if (null === $current) {
                $current = $period;
                continue;
            }

            $isContained = $current->contains($period);
            if ($isContained && $isPreviouslyContained) {
                continue;
            }

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

            $isPreviouslyContained = $isContained;
            if (!$isContained) {
                $current = $period;
            }
        }

        return $sequence;
    }
public function intersections ( ) : self { $ sequence = new self ( ) ; $ current = null ; $ isPreviouslyContained = false ; foreach ( $ this -> sorted ( [ $ this , 'sortByStartDate' ] ) as $ period ) { if ( null === $ current ) { $ current = $ period ; continue ; } $ isContained = $ current -> contains ( $ period ) ; if ( $ isContained && $ isPreviouslyContained ) { continue ; } if ( $ current -> overlaps ( $ period ) ) { $ sequence -> push ( $ current -> intersect ( $ period ) ) ; } $ isPreviouslyContained = $ isContained ; if ( ! $ isContained ) { $ current = $ period ; } } return $ sequence ; }
Returns the intersections inside the instance.
Returns the intersections inside the instance .