public function removeQueryString(array $params, $url = null)
    {
        $strUrl = static::prepareUrl($url);

        if (empty($params)) {
            return $strUrl;
        }

        $explodedUrl = explode('?', $strUrl, 2);

        if (2 === \count($explodedUrl)) {
            list($script, $queryString) = $explodedUrl;
        } else {
            list($script) = $explodedUrl;

            return $script;
        }

        parse_str($queryString, $queries);

        $queries = array_filter($queries);
        $queries = array_diff_key($queries, array_flip($params));

        $href = '';

        if (!empty($queries)) {
            $href .= '?'.http_build_query($queries, '', '&');
        }

        return $script.$href;
    }