original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Swap the file extension on a passed url or path
  
  @param $path_or_url
  @param $extension
  @return string
docstring_tokens: Swap the file extension on a passed url or path