original_string: public function build(
          stdClass $user,
          forum_entity $forum,
          discussion_entity $discussion
      ) : array {
  
          $favouriteids = [];
          if ($this->is_favourited($discussion, $forum->get_context(), $user)) {
              $favouriteids[] = $discussion->get_id();
          }
  
          $groupsbyid = $this->get_groups_available_in_forum($forum);
          $discussionexporter = $this->exporterfactory->get_discussion_exporter(
              $user, $forum, $discussion, $groupsbyid, $favouriteids
          );
  
          return (array) $discussionexporter->export($this->renderer);
      }
code: public function build(
          stdClass $user,
          forum_entity $forum,
          discussion_entity $discussion
      ) : array {
  
          $favouriteids = [];
          if ($this->is_favourited($discussion, $forum->get_context(), $user)) {
              $favouriteids[] = $discussion->get_id();
          }
  
          $groupsbyid = $this->get_groups_available_in_forum($forum);
          $discussionexporter = $this->exporterfactory->get_discussion_exporter(
              $user, $forum, $discussion, $groupsbyid, $favouriteids
          );
  
          return (array) $discussionexporter->export($this->renderer);
      }
code_tokens: public function build ( stdClass $ user , forum_entity $ forum , discussion_entity $ discussion ) : array { $ favouriteids = [ ] ; if ( $ this -> is_favourited ( $ discussion , $ forum -> get_context ( ) , $ user ) ) { $ favouriteids [ ] = $ discussion -> get_id ( ) ; } $ groupsbyid = $ this -> get_groups_available_in_forum ( $ forum ) ; $ discussionexporter = $ this -> exporterfactory -> get_discussion_exporter ( $ user , $ forum , $ discussion , $ groupsbyid , $ favouriteids ) ; return ( array ) $ discussionexporter -> export ( $ this -> renderer ) ; }
docstring: Build any additional variables for the exported discussion for a given set of discussions.
  
  This will typically be used for a list of discussions in the same forum.
  
  @param stdClass $user The user to export the posts for.
  @param forum_entity $forum The forum that each of the $discussions belong to
  @param discussion_entity $discussion A list of all discussions that each of the $posts belong to
  @return stdClass[] List of exported posts in the same order as the $posts array.
docstring_tokens: Build any additional variables for the exported discussion for a given set of discussions .