final private function verifySort(array $sort, string $label, array &$completeFields)
    {
        foreach ($sort as $key => $value) {
            $this->throwIfTrue(!is_string($key), "key in \${$label} was not a string");
            $this->throwIfTrue(
                $value !== 1 && $value !== -1,
                "value of \${$label} is not 1 or -1 for ascending and descending"
            );

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

            $completeFields["payload.{$key}"] = $value;
        }
    }
final private function verifySort ( array $ sort , string $ label , array & $ completeFields ) { foreach ( $ sort as $ key => $ value ) { $ this -> throwIfTrue ( ! is_string ( $ key ) , "key in \${$label} was not a string" ) ; $ this -> throwIfTrue ( $ value !== 1 && $ value !== - 1 , "value of \${$label} is not 1 or -1 for ascending and descending" ) ; $ completeFields [ "payload.{$key}" ] = $ value ; } }
Helper method to validate keys and values for the given sort array

@param array  $sort             The proposed sort for a mongo index.
@param string $label            The name of the variable given to the public ensureXIndex method.
@param array  &$completedFields The final index array with payload. prefix added to fields.

@return void
Helper method to validate keys and values for the given sort array