original_string: protected function write_data(string $path, string $data) {
          $targetpath = $this->path . DIRECTORY_SEPARATOR . $path;
          check_dir_exists(dirname($targetpath), true, true);
          if (file_put_contents($targetpath, $data) === false) {
              throw new \moodle_exception('cannotsavefile', 'error', '', $targetpath);
          }
          $this->files[$path] = $targetpath;
      }
code: protected function write_data(string $path, string $data) {
          $targetpath = $this->path . DIRECTORY_SEPARATOR . $path;
          check_dir_exists(dirname($targetpath), true, true);
          if (file_put_contents($targetpath, $data) === false) {
              throw new \moodle_exception('cannotsavefile', 'error', '', $targetpath);
          }
          $this->files[$path] = $targetpath;
      }
code_tokens: protected function write_data ( string $ path , string $ data ) { $ targetpath = $ this -> path . DIRECTORY_SEPARATOR . $ path ; check_dir_exists ( dirname ( $ targetpath ) , true , true ) ; if ( file_put_contents ( $ targetpath , $ data ) === false ) { throw new \ moodle_exception ( 'cannotsavefile' , 'error' , '' , $ targetpath ) ; } $ this -> files [ $ path ] = $ targetpath ; }
docstring: Write the data to the specified path.
  
  @param   string          $path       The path to export the data at.
  @param   string          $data       The data to be exported.
  @throws  \moodle_exception           If the file cannot be written for some reason.
docstring_tokens: Write the data to the specified path .