original_string: private function prepare_post_leap2a(portfolio_format_leap2a_writer $leapwriter, $post, $posthtml) {
          $entry = new portfolio_format_leap2a_entry('forumpost' . $post->id,  $post->subject, 'resource', $posthtml);
          $entry->published = $post->created;
          $entry->updated = $post->modified;
          $entry->author = $post->author;
          if (is_array($this->keyedfiles) && array_key_exists($post->id, $this->keyedfiles) && is_array($this->keyedfiles[$post->id])) {
              $leapwriter->link_files($entry, $this->keyedfiles[$post->id], 'forumpost' . $post->id . 'attachment');
          }
          $entry->add_category('web', 'resource_type');
          $leapwriter->add_entry($entry);
          return $entry->id;
      }
code: private function prepare_post_leap2a(portfolio_format_leap2a_writer $leapwriter, $post, $posthtml) {
          $entry = new portfolio_format_leap2a_entry('forumpost' . $post->id,  $post->subject, 'resource', $posthtml);
          $entry->published = $post->created;
          $entry->updated = $post->modified;
          $entry->author = $post->author;
          if (is_array($this->keyedfiles) && array_key_exists($post->id, $this->keyedfiles) && is_array($this->keyedfiles[$post->id])) {
              $leapwriter->link_files($entry, $this->keyedfiles[$post->id], 'forumpost' . $post->id . 'attachment');
          }
          $entry->add_category('web', 'resource_type');
          $leapwriter->add_entry($entry);
          return $entry->id;
      }
code_tokens: private function prepare_post_leap2a ( portfolio_format_leap2a_writer $ leapwriter , $ post , $ posthtml ) { $ entry = new portfolio_format_leap2a_entry ( 'forumpost' . $ post -> id , $ post -> subject , 'resource' , $ posthtml ) ; $ entry -> published = $ post -> created ; $ entry -> updated = $ post -> modified ; $ entry -> author = $ post -> author ; if ( is_array ( $ this -> keyedfiles ) && array_key_exists ( $ post -> id , $ this -> keyedfiles ) && is_array ( $ this -> keyedfiles [ $ post -> id ] ) ) { $ leapwriter -> link_files ( $ entry , $ this -> keyedfiles [ $ post -> id ] , 'forumpost' . $ post -> id . 'attachment' ) ; } $ entry -> add_category ( 'web' , 'resource_type' ) ; $ leapwriter -> add_entry ( $ entry ) ; return $ entry -> id ; }
docstring: helper function to add a leap2a entry element
  that corresponds to a single forum post,
  including any attachments
  
  the entry/ies are added directly to the leapwriter, which is passed by ref
  
  @param portfolio_format_leap2a_writer $leapwriter writer object to add entries to
  @param object $post                               the stdclass object representing the database record
  @param string $posthtml                           the content of the post (prepared by {@link prepare_post}
  
  @return int id of new entry
docstring_tokens: helper function to add a leap2a entry element that corresponds to a single forum post including any attachments