public static function nextRanges(ObjectList $list): array
    {
        $ranges = [];

        // The end index of the next list. We do this here in case there are no further ranges to return.
        $endIndex = $list->getStartIndex() + $list->getItemsPerPage() - 1;

        // The last index of the final list.
        $finalEndIndex = $list->getTotalResults();

        while ($endIndex < $finalEndIndex) {
            // The start index of the next list.
            $startIndex = ($startIndex ?? $list->getStartIndex()) + $list->getEntryCount();

            // We need to be sure we never return an end range greater than the total count of objects.
            $endIndex = min($startIndex + $list->getItemsPerPage() - 1, $finalEndIndex);

            $range = new self();
            $range->setStartIndex($startIndex)
                ->setEndIndex($endIndex);
            $ranges[] = $range;
        }

        return $ranges;
    }
public static function nextRanges(ObjectList $list): array
    {
        $ranges = [];

        // The end index of the next list. We do this here in case there are no further ranges to return.
        $endIndex = $list->getStartIndex() + $list->getItemsPerPage() - 1;

        // The last index of the final list.
        $finalEndIndex = $list->getTotalResults();

        while ($endIndex < $finalEndIndex) {
            // The start index of the next list.
            $startIndex = ($startIndex ?? $list->getStartIndex()) + $list->getEntryCount();

            // We need to be sure we never return an end range greater than the total count of objects.
            $endIndex = min($startIndex + $list->getItemsPerPage() - 1, $finalEndIndex);

            $range = new self();
            $range->setStartIndex($startIndex)
                ->setEndIndex($endIndex);
            $ranges[] = $range;
        }

        return $ranges;
    }
public static function nextRanges ( ObjectList $ list ) : array { $ ranges = [ ] ; // The end index of the next list. We do this here in case there are no further ranges to return. $ endIndex = $ list -> getStartIndex ( ) + $ list -> getItemsPerPage ( ) - 1 ; // The last index of the final list. $ finalEndIndex = $ list -> getTotalResults ( ) ; while ( $ endIndex < $ finalEndIndex ) { // The start index of the next list. $ startIndex = ( $ startIndex ?? $ list -> getStartIndex ( ) ) + $ list -> getEntryCount ( ) ; // We need to be sure we never return an end range greater than the total count of objects. $ endIndex = min ( $ startIndex + $ list -> getItemsPerPage ( ) - 1 , $ finalEndIndex ) ; $ range = new self ( ) ; $ range -> setStartIndex ( $ startIndex ) -> setEndIndex ( $ endIndex ) ; $ ranges [ ] = $ range ; } return $ ranges ; }
Given an object list, return the ranges for each subsequent page.

@param ObjectList $list The list to generate ranges for.

@return static[] An array of Range objects.
Given an object list return the ranges for each subsequent page .