original_string: public function get_discussion_renderer(
          forum_entity $forum,
          discussion_entity $discussion,
          int $displaymode
      ) : discussion_renderer {
  
          $capabilitymanager = $this->managerfactory->get_capability_manager($forum);
          $ratingmanager = $this->managerfactory->get_rating_manager();
          $rendererbase = $this->rendererbase;
  
          $baseurl = $this->urlfactory->get_discussion_view_url_from_discussion($discussion);
          $notifications = [];
  
          return new discussion_renderer(
              $forum,
              $discussion,
              $displaymode,
              $rendererbase,
              $this->get_single_discussion_posts_renderer($displaymode, false),
              $this->page,
              $this->legacydatamapperfactory,
              $this->exporterfactory,
              $this->vaultfactory,
              $capabilitymanager,
              $ratingmanager,
              $this->entityfactory->get_exported_posts_sorter(),
              $baseurl,
              $notifications,
              function($discussion, $user, $forum) {
                  $exportbuilder = $this->builderfactory->get_exported_discussion_builder();
                  return $exportedposts = $exportbuilder->build(
                      $user,
                      $forum,
                      $discussion
                  );
              }
          );
      }
code: public function get_discussion_renderer(
          forum_entity $forum,
          discussion_entity $discussion,
          int $displaymode
      ) : discussion_renderer {
  
          $capabilitymanager = $this->managerfactory->get_capability_manager($forum);
          $ratingmanager = $this->managerfactory->get_rating_manager();
          $rendererbase = $this->rendererbase;
  
          $baseurl = $this->urlfactory->get_discussion_view_url_from_discussion($discussion);
          $notifications = [];
  
          return new discussion_renderer(
              $forum,
              $discussion,
              $displaymode,
              $rendererbase,
              $this->get_single_discussion_posts_renderer($displaymode, false),
              $this->page,
              $this->legacydatamapperfactory,
              $this->exporterfactory,
              $this->vaultfactory,
              $capabilitymanager,
              $ratingmanager,
              $this->entityfactory->get_exported_posts_sorter(),
              $baseurl,
              $notifications,
              function($discussion, $user, $forum) {
                  $exportbuilder = $this->builderfactory->get_exported_discussion_builder();
                  return $exportedposts = $exportbuilder->build(
                      $user,
                      $forum,
                      $discussion
                  );
              }
          );
      }
code_tokens: public function get_discussion_renderer ( forum_entity $ forum , discussion_entity $ discussion , int $ displaymode ) : discussion_renderer { $ capabilitymanager = $ this -> managerfactory -> get_capability_manager ( $ forum ) ; $ ratingmanager = $ this -> managerfactory -> get_rating_manager ( ) ; $ rendererbase = $ this -> rendererbase ; $ baseurl = $ this -> urlfactory -> get_discussion_view_url_from_discussion ( $ discussion ) ; $ notifications = [ ] ; return new discussion_renderer ( $ forum , $ discussion , $ displaymode , $ rendererbase , $ this -> get_single_discussion_posts_renderer ( $ displaymode , false ) , $ this -> page , $ this -> legacydatamapperfactory , $ this -> exporterfactory , $ this -> vaultfactory , $ capabilitymanager , $ ratingmanager , $ this -> entityfactory -> get_exported_posts_sorter ( ) , $ baseurl , $ notifications , function ( $ discussion , $ user , $ forum ) { $ exportbuilder = $ this -> builderfactory -> get_exported_discussion_builder ( ) ; return $ exportedposts = $ exportbuilder -> build ( $ user , $ forum , $ discussion ) ; } ) ; }
docstring: Create a discussion renderer for the given forum and discussion.
  
  @param forum_entity $forum Forum the discussion belongs to
  @param discussion_entity $discussion Discussion to render
  @param int $displaymode How should the posts be formatted?
  @return discussion_renderer
docstring_tokens: Create a discussion renderer for the given forum and discussion .