protected static function paginateGroupChoices(array $choices, $startTo, $endTo)
    {
        $paginatedChoices = [];
        $index = 0;

        foreach ($choices as $groupName => $groupChoices) {
            foreach ($groupChoices as $key => $choice) {
                if ($index >= $startTo && $index < $endTo) {
                    $paginatedChoices[$groupName][$key] = $choice;
                }

                ++$index;
            }
        }

        return $paginatedChoices;
    }
protected static function paginateGroupChoices(array $choices, $startTo, $endTo)
    {
        $paginatedChoices = [];
        $index = 0;

        foreach ($choices as $groupName => $groupChoices) {
            foreach ($groupChoices as $key => $choice) {
                if ($index >= $startTo && $index < $endTo) {
                    $paginatedChoices[$groupName][$key] = $choice;
                }

                ++$index;
            }
        }

        return $paginatedChoices;
    }
protected static function paginateGroupChoices ( array $ choices , $ startTo , $ endTo ) { $ paginatedChoices = [ ] ; $ index = 0 ; foreach ( $ choices as $ groupName => $ groupChoices ) { foreach ( $ groupChoices as $ key => $ choice ) { if ( $ index >= $ startTo && $ index < $ endTo ) { $ paginatedChoices [ $ groupName ] [ $ key ] = $ choice ; } ++ $ index ; } } return $ paginatedChoices ; }
Paginate the flatten group choices.

@param array $choices The choices
@param int   $startTo The start index of pagination
@param int   $endTo   The end index of pagination

@return array The paginated choices
Paginate the flatten group choices .