private function decomposeUrl($path_or_url)
    {
        $result = array();

        if (filter_var($path_or_url, FILTER_VALIDATE_URL)) {
            $url_parts = parse_url($path_or_url);
            $result['prefix'] = $url_parts['scheme'] . "://" . $url_parts['host'];
            $result['path'] = $url_parts['path'];
            $result['suffix'] = "";
            $result['suffix'] .= (empty($url_parts['query'])) ? "" : "?" . $url_parts['query'];
            $result['suffix'] .= (empty($url_parts['fragment'])) ? "" : "#" . $url_parts['fragment'];
        } else {
            $result['prefix'] = "";
            $result['path'] = $path_or_url;
            $result['suffix'] = "";
        }

        return $result;
    }
private function decomposeUrl($path_or_url)
    {
        $result = array();

        if (filter_var($path_or_url, FILTER_VALIDATE_URL)) {
            $url_parts = parse_url($path_or_url);
            $result['prefix'] = $url_parts['scheme'] . "://" . $url_parts['host'];
            $result['path'] = $url_parts['path'];
            $result['suffix'] = "";
            $result['suffix'] .= (empty($url_parts['query'])) ? "" : "?" . $url_parts['query'];
            $result['suffix'] .= (empty($url_parts['fragment'])) ? "" : "#" . $url_parts['fragment'];
        } else {
            $result['prefix'] = "";
            $result['path'] = $path_or_url;
            $result['suffix'] = "";
        }

        return $result;
    }
private function decomposeUrl ( $ path_or_url ) { $ result = array ( ) ; if ( filter_var ( $ path_or_url , FILTER_VALIDATE_URL ) ) { $ url_parts = parse_url ( $ path_or_url ) ; $ result [ 'prefix' ] = $ url_parts [ 'scheme' ] . "://" . $ url_parts [ 'host' ] ; $ result [ 'path' ] = $ url_parts [ 'path' ] ; $ result [ 'suffix' ] = "" ; $ result [ 'suffix' ] .= ( empty ( $ url_parts [ 'query' ] ) ) ? "" : "?" . $ url_parts [ 'query' ] ; $ result [ 'suffix' ] .= ( empty ( $ url_parts [ 'fragment' ] ) ) ? "" : "#" . $ url_parts [ 'fragment' ] ; } else { $ result [ 'prefix' ] = "" ; $ result [ 'path' ] = $ path_or_url ; $ result [ 'suffix' ] = "" ; } return $ result ; }
Decompose a url into a prefix, path, and suffix

@param $path_or_url
@return array
Decompose a url into a prefix path and suffix