original_string: public function delete() {
          if (!$this->is_writable()) {
              return false;
          }
  
          if ($this->is_directory()) {
              $filepath = $this->lf->get_filepath();
              $fs = get_file_storage();
              $storedfiles = $fs->get_area_files($this->context->id, $this->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid());
              foreach ($storedfiles as $file) {
                  if (strpos($file->get_filepath(), $filepath) === 0) {
                      $file->delete();
                  }
              }
          }
  
          return $this->lf->delete();
      }
code: public function delete() {
          if (!$this->is_writable()) {
              return false;
          }
  
          if ($this->is_directory()) {
              $filepath = $this->lf->get_filepath();
              $fs = get_file_storage();
              $storedfiles = $fs->get_area_files($this->context->id, $this->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid());
              foreach ($storedfiles as $file) {
                  if (strpos($file->get_filepath(), $filepath) === 0) {
                      $file->delete();
                  }
              }
          }
  
          return $this->lf->delete();
      }
code_tokens: public function delete ( ) { if ( ! $ this -> is_writable ( ) ) { return false ; } if ( $ this -> is_directory ( ) ) { $ filepath = $ this -> lf -> get_filepath ( ) ; $ fs = get_file_storage ( ) ; $ storedfiles = $ fs -> get_area_files ( $ this -> context -> id , $ this -> get_component ( ) , $ this -> lf -> get_filearea ( ) , $ this -> lf -> get_itemid ( ) ) ; foreach ( $ storedfiles as $ file ) { if ( strpos ( $ file -> get_filepath ( ) , $ filepath ) === 0 ) { $ file -> delete ( ) ; } } } return $ this -> lf -> delete ( ) ; }
docstring: Delete file, make sure file is deletable first.
  
  @return bool success
docstring_tokens: Delete file make sure file is deletable first .