original_string: public function get_file($url, $filename = '') {
          global $CFG;
  
          $path = $this->prepare_file($filename);
          $c = new curl;
  
          $result = $c->download_one($url, null, array('filepath' => $path, 'timeout' => $CFG->repositorygetfiletimeout));
          if ($result !== true) {
              throw new moodle_exception('errorwhiledownload', 'repository', '', $result);
          }
          return array('path'=>$path, 'url'=>$url);
      }
code: public function get_file($url, $filename = '') {
          global $CFG;
  
          $path = $this->prepare_file($filename);
          $c = new curl;
  
          $result = $c->download_one($url, null, array('filepath' => $path, 'timeout' => $CFG->repositorygetfiletimeout));
          if ($result !== true) {
              throw new moodle_exception('errorwhiledownload', 'repository', '', $result);
          }
          return array('path'=>$path, 'url'=>$url);
      }
code_tokens: public function get_file ( $ url , $ filename = '' ) { global $ CFG ; $ path = $ this -> prepare_file ( $ filename ) ; $ c = new curl ; $ result = $ c -> download_one ( $ url , null , array ( 'filepath' => $ path , 'timeout' => $ CFG -> repositorygetfiletimeout ) ) ; if ( $ result !== true ) { throw new moodle_exception ( 'errorwhiledownload' , 'repository' , '' , $ result ) ; } return array ( 'path' => $ path , 'url' => $ url ) ; }
docstring: Downloads a file from external repository and saves it in temp dir
  
  Function get_file() must be implemented by repositories that support returntypes
  FILE_INTERNAL or FILE_REFERENCE. It is invoked to pick up the file and copy it
  to moodle. This function is not called for moodle repositories, the function
  {@link repository::copy_to_area()} is used instead.
  
  This function can be overridden by subclass if the files.reference field contains
  not just URL or if request should be done differently.
  
  @see curl
  @throws file_exception when error occured
  
  @param string $url the content of files.reference field, in this implementaion
  it is asssumed that it contains the string with URL of the file
  @param string $filename filename (without path) to save the downloaded file in the
  temporary directory, if omitted or file already exists the new filename will be generated
  @return array with elements:
  path: internal location of the file
  url: URL to the source (from parameters)
docstring_tokens: Downloads a file from external repository and saves it in temp dir