public function swapExtensionFilter($path_or_url, $extension)
    {
        $path = $this->decomposeUrl($path_or_url);
        $path_parts = pathinfo($path['path']);
        $new_path = $path_parts['filename'] . "." . $extension;
        if (!empty($path_parts['dirname']) && $path_parts['dirname'] !== ".") {
            $new_path = $path_parts['dirname'] . DIRECTORY_SEPARATOR . $new_path;
            $new_path = preg_replace('#/+#', '/', $new_path);
        }
        $output = $path['prefix'] . $new_path . $path['suffix'];
        return $output;
    }