private function buildQueryParameters(array $paramValues)
    {
        if (empty($paramValues)) {
            return '';
        }

        $query = [];
        foreach ($paramValues as $param => $value) {
            if (is_array($value)) {
                $value = join(',', $value);
            } elseif (is_bool($value)) {
                $value = $value ? 'true' : 'false';
            } elseif (is_callable($value)) {
                $value = $value();
            }
            $query[] = $param.'='.urlencode($value);
        }
        return '?'.join('&', $query);
    }