public static function combine(array $ranges)
    {
        $range = new static();

        foreach ($ranges as $cur_range) {
            $cur_start = $cur_range->after;
            $cur_end = $cur_range->before;

            if (is_null($range->before) || $cur_end->lt($range->before)) {
                $range->before = $cur_end;
            }

            if (is_null($range->after) || $cur_start->gt($range->after)) {
                $range->after = $cur_start;
            }
        }

        return $range;
    }