/** * Alter the request object for the given fields using the given callback * * @param string[] $fieldList List of fields to work on * @param callback $callback Function to run on the field */ protected function mergeRequest($fieldList, $callback) { $mergeArray = []; foreach ($fieldList as $field) { $mergeArray[$field] = $callback($field); } Request::merge($mergeArray); }