private static function verifySort(array $sort, $label, &$completeFields)
{
foreach ($sort as $key => $value) {
if (!is_string($key)) {
throw new \InvalidArgumentException("key in \${$label} was not a string");
}
if ($value !== 1 && $value !== -1) {
throw new \InvalidArgumentException("value of \${$label} is not 1 or -1 for ascending and descending");
}
$completeFields["payload.{$key}"] = $value;
}
}