I would prefer this:
```php
$fieldSets = [
    'count' => ['fields' => [], 'includeRunning' => true/false, ...],
    'get' => ['beforeSort' => [], 'afterSort' => []],
];

foreach ($fieldSets as $type => $fieldSet) {
    if ($type === 'count') {
        // handle count
        continue;
    }

     if ($type === 'get') {
         // handle get
         continue;
     }

     throw;
}

// add indexes ...
```