original_string: public function get_parent_directory() {
          if ($this->file_record->filepath === '/' and $this->file_record->filename === '.') {
              //root dir does not have parent
              return null;
          }
  
          if ($this->file_record->filename !== '.') {
              return $this->fs->create_directory($this->file_record->contextid, $this->file_record->component, $this->file_record->filearea, $this->file_record->itemid, $this->file_record->filepath);
          }
  
          $filepath = $this->file_record->filepath;
          $filepath = trim($filepath, '/');
          $dirs = explode('/', $filepath);
          array_pop($dirs);
          $filepath = implode('/', $dirs);
          $filepath = ($filepath === '') ? '/' : "/$filepath/";
  
          return $this->fs->create_directory($this->file_record->contextid, $this->file_record->component, $this->file_record->filearea, $this->file_record->itemid, $filepath);
      }
code: public function get_parent_directory() {
          if ($this->file_record->filepath === '/' and $this->file_record->filename === '.') {
              //root dir does not have parent
              return null;
          }
  
          if ($this->file_record->filename !== '.') {
              return $this->fs->create_directory($this->file_record->contextid, $this->file_record->component, $this->file_record->filearea, $this->file_record->itemid, $this->file_record->filepath);
          }
  
          $filepath = $this->file_record->filepath;
          $filepath = trim($filepath, '/');
          $dirs = explode('/', $filepath);
          array_pop($dirs);
          $filepath = implode('/', $dirs);
          $filepath = ($filepath === '') ? '/' : "/$filepath/";
  
          return $this->fs->create_directory($this->file_record->contextid, $this->file_record->component, $this->file_record->filearea, $this->file_record->itemid, $filepath);
      }
code_tokens: public function get_parent_directory ( ) { if ( $ this -> file_record -> filepath === '/' and $ this -> file_record -> filename === '.' ) { //root dir does not have parent return null ; } if ( $ this -> file_record -> filename !== '.' ) { return $ this -> fs -> create_directory ( $ this -> file_record -> contextid , $ this -> file_record -> component , $ this -> file_record -> filearea , $ this -> file_record -> itemid , $ this -> file_record -> filepath ) ; } $ filepath = $ this -> file_record -> filepath ; $ filepath = trim ( $ filepath , '/' ) ; $ dirs = explode ( '/' , $ filepath ) ; array_pop ( $ dirs ) ; $ filepath = implode ( '/' , $ dirs ) ; $ filepath = ( $ filepath === '' ) ? '/' : "/$filepath/" ; return $ this -> fs -> create_directory ( $ this -> file_record -> contextid , $ this -> file_record -> component , $ this -> file_record -> filearea , $ this -> file_record -> itemid , $ filepath ) ; }
docstring: Returns parent directory, creates missing parents if needed.
  
  @return stored_file
docstring_tokens: Returns parent directory creates missing parents if needed .