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

            if (!$interval->overlaps($period) && !$interval->abuts($period)) {
                $sequence->push($interval->gap($period));
            }

            if (!$interval->contains($period)) {
                $interval = $period;
            }
        }

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

            if (!$interval->overlaps($period) && !$interval->abuts($period)) {
                $sequence->push($interval->gap($period));
            }

            if (!$interval->contains($period)) {
                $interval = $period;
            }
        }

        return $sequence;
    }
public function gaps ( ) : self { $ sequence = new self ( ) ; $ interval = null ; foreach ( $ this -> sorted ( [ $ this , 'sortByStartDate' ] ) as $ period ) { if ( null === $ interval ) { $ interval = $ period ; continue ; } if ( ! $ interval -> overlaps ( $ period ) && ! $ interval -> abuts ( $ period ) ) { $ sequence -> push ( $ interval -> gap ( $ period ) ) ; } if ( ! $ interval -> contains ( $ period ) ) { $ interval = $ period ; } } return $ sequence ; }
Returns the gaps inside the instance.
Returns the gaps inside the instance .