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)]
        );
    }
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)]
        );
    }
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 ) ] ) ; }
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
Render the given posts for the forums and discussions .