original_string: public function render(
          stdClass $user,
          array $forums,
          array $discussions,
          array $posts
      ) : string {
          // Format the forums and discussion to make them more easily accessed later.
          $forums = array_reduce($forums, function($carry, $forum) {
              $carry[$forum->get_id()] = $forum;
              return $carry;
          }, []);
          $discussions = array_reduce($discussions, function($carry, $discussion) {
              $carry[$discussion->get_id()] = $discussion;
              return $carry;
          }, []);
  
          $exportedposts = $this->exportedpostsbuilder->build(
              $user,
              $forums,
              $discussions,
              $posts
          );
  
          if ($this->postprocessfortemplate !== null) {
              // We've got some post processing to do!
              $exportedposts = ($this->postprocessfortemplate)($exportedposts, $forums, $discussions, $user);
          }
  
          return $this->renderer->render_from_template(
              $this->template,
              ['posts' => array_values($exportedposts)]
          );
      }
code: public function render(
          stdClass $user,
          array $forums,
          array $discussions,
          array $posts
      ) : string {
          // Format the forums and discussion to make them more easily accessed later.
          $forums = array_reduce($forums, function($carry, $forum) {
              $carry[$forum->get_id()] = $forum;
              return $carry;
          }, []);
          $discussions = array_reduce($discussions, function($carry, $discussion) {
              $carry[$discussion->get_id()] = $discussion;
              return $carry;
          }, []);
  
          $exportedposts = $this->exportedpostsbuilder->build(
              $user,
              $forums,
              $discussions,
              $posts
          );
  
          if ($this->postprocessfortemplate !== null) {
              // We've got some post processing to do!
              $exportedposts = ($this->postprocessfortemplate)($exportedposts, $forums, $discussions, $user);
          }
  
          return $this->renderer->render_from_template(
              $this->template,
              ['posts' => array_values($exportedposts)]
          );
      }
code_tokens: public function render ( stdClass $ user , array $ forums , array $ discussions , array $ posts ) : string { // Format the forums and discussion to make them more easily accessed later. $ forums = array_reduce ( $ forums , function ( $ carry , $ forum ) { $ carry [ $ forum -> get_id ( ) ] = $ forum ; return $ carry ; } , [ ] ) ; $ discussions = array_reduce ( $ discussions , function ( $ carry , $ discussion ) { $ carry [ $ discussion -> get_id ( ) ] = $ discussion ; return $ carry ; } , [ ] ) ; $ exportedposts = $ this -> exportedpostsbuilder -> build ( $ user , $ forums , $ discussions , $ posts ) ; if ( $ this -> postprocessfortemplate !== null ) { // We've got some post processing to do! $ exportedposts = ( $ this -> postprocessfortemplate ) ( $ exportedposts , $ forums , $ discussions , $ user ) ; } return $ this -> renderer -> render_from_template ( $ this -> template , [ 'posts' => array_values ( $ exportedposts ) ] ) ; }
docstring: Render the given posts for the forums and discussions.
  
  @param stdClass $user The user viewing the posts
  @param forum_entity[] $forums A list of all forums for these posts
  @param discussion_entity[] $discussions A list of all discussions for these posts
  @param post_entity[] $posts The posts to render
  @return string
docstring_tokens: Render the given posts for the forums and discussions .