original_string: public function data_preset_get_file_contents(&$filestorage, &$fileobj, $dir, $filename) {
          if(empty($filestorage) || empty($fileobj)) {
              if (substr($dir, -1)!='/') {
                  $dir .= '/';
              }
              if (file_exists($dir.$filename)) {
                  return file_get_contents($dir.$filename);
              } else {
                  return null;
              }
          } else {
              if ($filestorage->file_exists(DATA_PRESET_CONTEXT, DATA_PRESET_COMPONENT, DATA_PRESET_FILEAREA, 0, $fileobj->get_filepath(), $filename)) {
                  $file = $filestorage->get_file(DATA_PRESET_CONTEXT, DATA_PRESET_COMPONENT, DATA_PRESET_FILEAREA, 0, $fileobj->get_filepath(), $filename);
                  return $file->get_content();
              } else {
                  return null;
              }
          }
  
      }
code: public function data_preset_get_file_contents(&$filestorage, &$fileobj, $dir, $filename) {
          if(empty($filestorage) || empty($fileobj)) {
              if (substr($dir, -1)!='/') {
                  $dir .= '/';
              }
              if (file_exists($dir.$filename)) {
                  return file_get_contents($dir.$filename);
              } else {
                  return null;
              }
          } else {
              if ($filestorage->file_exists(DATA_PRESET_CONTEXT, DATA_PRESET_COMPONENT, DATA_PRESET_FILEAREA, 0, $fileobj->get_filepath(), $filename)) {
                  $file = $filestorage->get_file(DATA_PRESET_CONTEXT, DATA_PRESET_COMPONENT, DATA_PRESET_FILEAREA, 0, $fileobj->get_filepath(), $filename);
                  return $file->get_content();
              } else {
                  return null;
              }
          }
  
      }
code_tokens: public function data_preset_get_file_contents ( & $ filestorage , & $ fileobj , $ dir , $ filename ) { if ( empty ( $ filestorage ) || empty ( $ fileobj ) ) { if ( substr ( $ dir , - 1 ) != '/' ) { $ dir .= '/' ; } if ( file_exists ( $ dir . $ filename ) ) { return file_get_contents ( $ dir . $ filename ) ; } else { return null ; } } else { if ( $ filestorage -> file_exists ( DATA_PRESET_CONTEXT , DATA_PRESET_COMPONENT , DATA_PRESET_FILEAREA , 0 , $ fileobj -> get_filepath ( ) , $ filename ) ) { $ file = $ filestorage -> get_file ( DATA_PRESET_CONTEXT , DATA_PRESET_COMPONENT , DATA_PRESET_FILEAREA , 0 , $ fileobj -> get_filepath ( ) , $ filename ) ; return $ file -> get_content ( ) ; } else { return null ; } } }
docstring: Retreive the contents of a file. That file may either be in a conventional directory of the Moodle file storage
  @param file_storage $filestorage. should be null if using a conventional directory
  @param stored_file $fileobj the directory to look in. null if using a conventional directory
  @param string $dir the directory to look in. null if using the Moodle file storage
  @param string $filename the name of the file we want
  @return string the contents of the file or null if the file doesn't exist.
docstring_tokens: Retreive the contents of a file . That file may either be in a conventional directory of the Moodle file storage