public function updateURLWithParameters($url, array $params)
    {
        if (empty($params)) {
            return $url;
        }

        $parts = parse_url($url);

        $scheme = isset($parts['scheme']) ? $parts['scheme'] : null;
        if ($scheme) {
            $scheme .= ':';
        }

        $host = isset($parts['host']) ? $parts['host'] : null;
        if ($host) {
            $host = "//$host";
        }
        $path = isset($parts['path']) ? $parts['path'] : null;

        //Merge parameters
        $query = isset($parts['query']) ? $parts['query'] : null;
        $params += $this->getParameterFromQuery($query);
        if (!empty($params)) {
            $query = '?' . http_build_query($params);
        }

        $fragment = isset($parts['fragment']) ? $parts['fragment'] : null;
        if ($fragment) {
            $fragment = "#$fragment";
        }

        return "{$scheme}{$host}{$path}{$query}$fragment";
    }
public function updateURLWithParameters($url, array $params)
    {
        if (empty($params)) {
            return $url;
        }

        $parts = parse_url($url);

        $scheme = isset($parts['scheme']) ? $parts['scheme'] : null;
        if ($scheme) {
            $scheme .= ':';
        }

        $host = isset($parts['host']) ? $parts['host'] : null;
        if ($host) {
            $host = "//$host";
        }
        $path = isset($parts['path']) ? $parts['path'] : null;

        //Merge parameters
        $query = isset($parts['query']) ? $parts['query'] : null;
        $params += $this->getParameterFromQuery($query);
        if (!empty($params)) {
            $query = '?' . http_build_query($params);
        }

        $fragment = isset($parts['fragment']) ? $parts['fragment'] : null;
        if ($fragment) {
            $fragment = "#$fragment";
        }

        return "{$scheme}{$host}{$path}{$query}$fragment";
    }
public function updateURLWithParameters ( $ url , array $ params ) { if ( empty ( $ params ) ) { return $ url ; } $ parts = parse_url ( $ url ) ; $ scheme = isset ( $ parts [ 'scheme' ] ) ? $ parts [ 'scheme' ] : null ; if ( $ scheme ) { $ scheme .= ':' ; } $ host = isset ( $ parts [ 'host' ] ) ? $ parts [ 'host' ] : null ; if ( $ host ) { $ host = "//$host" ; } $ path = isset ( $ parts [ 'path' ] ) ? $ parts [ 'path' ] : null ; //Merge parameters $ query = isset ( $ parts [ 'query' ] ) ? $ parts [ 'query' ] : null ; $ params += $ this -> getParameterFromQuery ( $ query ) ; if ( ! empty ( $ params ) ) { $ query = '?' . http_build_query ( $ params ) ; } $ fragment = isset ( $ parts [ 'fragment' ] ) ? $ parts [ 'fragment' ] : null ; if ( $ fragment ) { $ fragment = "#$fragment" ; } return "{$scheme}{$host}{$path}{$query}$fragment" ; }
Updates the URL provided with the new parameters
@param string $url
@param array $params
@return string updated URL
Updates the URL provided with the new parameters