public static function buildUrl(string $url, $parameters = null, int $encoding = PHP_QUERY_RFC3986) : string
    {
        if (empty($parameters)) {
            return $url;
        }

        $url = UrlHelper::removeTrailingSlash($url);

        if (StringHelper::contains($url, '?')) {
            $url .= '&';
        } else {
            $url .= "?";
        }

        return $url . http_build_query($parameters, null, '&', $encoding);
    }