protected function getQueryString(?array $query) : ?string
    {
        if (empty($query)) {
            return null;
        }

        return '?' . http_build_query($query, null, '&', PHP_QUERY_RFC3986);
    }