original_string: private function get_detailed_discussion_list_renderer(
          forum_entity $forum,
          string $template
      ) : discussion_list_renderer {
  
          $capabilitymanager = $this->managerfactory->get_capability_manager($forum);
          $rendererbase = $this->rendererbase;
          $notifications = [];
  
          return new discussion_list_renderer(
              $forum,
              $rendererbase,
              $this->legacydatamapperfactory,
              $this->exporterfactory,
              $this->vaultfactory,
              $this->builderfactory,
              $capabilitymanager,
              $this->urlfactory,
              $template,
              $notifications,
              function($discussions, $user, $forum) use ($capabilitymanager) {
                  $exportedpostsbuilder = $this->builderfactory->get_exported_posts_builder();
                  $discussionentries = [];
                  $postentries = [];
                  foreach ($discussions as $discussion) {
                      $discussionentries[] = $discussion->get_discussion();
                      $discussionentriesids[] = $discussion->get_discussion()->get_id();
                      $postentries[] = $discussion->get_first_post();
                  }
  
                  $exportedposts['posts'] = $exportedpostsbuilder->build(
                      $user,
                      [$forum],
                      $discussionentries,
                      $postentries
                  );
  
                  $postvault = $this->vaultfactory->get_post_vault();
                  $canseeanyprivatereply = $capabilitymanager->can_view_any_private_reply($user);
                  $discussionrepliescount = $postvault->get_reply_count_for_discussion_ids(
                          $user,
                          $discussionentriesids,
                          $canseeanyprivatereply
                      );
  
                  array_walk($exportedposts['posts'], function($post) use ($discussionrepliescount) {
                      $post->discussionrepliescount = $discussionrepliescount[$post->discussionid] ?? 0;
                      // TODO: Find a better solution due to language differences when defining the singular and plural form.
                      $post->isreplyplural = $post->discussionrepliescount != 1 ? true : false;
                  });
  
                  $exportedposts['state']['hasdiscussions'] = $exportedposts['posts'] ? true : false;
  
                  return $exportedposts;
              }
          );
      }
code: private function get_detailed_discussion_list_renderer(
          forum_entity $forum,
          string $template
      ) : discussion_list_renderer {
  
          $capabilitymanager = $this->managerfactory->get_capability_manager($forum);
          $rendererbase = $this->rendererbase;
          $notifications = [];
  
          return new discussion_list_renderer(
              $forum,
              $rendererbase,
              $this->legacydatamapperfactory,
              $this->exporterfactory,
              $this->vaultfactory,
              $this->builderfactory,
              $capabilitymanager,
              $this->urlfactory,
              $template,
              $notifications,
              function($discussions, $user, $forum) use ($capabilitymanager) {
                  $exportedpostsbuilder = $this->builderfactory->get_exported_posts_builder();
                  $discussionentries = [];
                  $postentries = [];
                  foreach ($discussions as $discussion) {
                      $discussionentries[] = $discussion->get_discussion();
                      $discussionentriesids[] = $discussion->get_discussion()->get_id();
                      $postentries[] = $discussion->get_first_post();
                  }
  
                  $exportedposts['posts'] = $exportedpostsbuilder->build(
                      $user,
                      [$forum],
                      $discussionentries,
                      $postentries
                  );
  
                  $postvault = $this->vaultfactory->get_post_vault();
                  $canseeanyprivatereply = $capabilitymanager->can_view_any_private_reply($user);
                  $discussionrepliescount = $postvault->get_reply_count_for_discussion_ids(
                          $user,
                          $discussionentriesids,
                          $canseeanyprivatereply
                      );
  
                  array_walk($exportedposts['posts'], function($post) use ($discussionrepliescount) {
                      $post->discussionrepliescount = $discussionrepliescount[$post->discussionid] ?? 0;
                      // TODO: Find a better solution due to language differences when defining the singular and plural form.
                      $post->isreplyplural = $post->discussionrepliescount != 1 ? true : false;
                  });
  
                  $exportedposts['state']['hasdiscussions'] = $exportedposts['posts'] ? true : false;
  
                  return $exportedposts;
              }
          );
      }
code_tokens: private function get_detailed_discussion_list_renderer ( forum_entity $ forum , string $ template ) : discussion_list_renderer { $ capabilitymanager = $ this -> managerfactory -> get_capability_manager ( $ forum ) ; $ rendererbase = $ this -> rendererbase ; $ notifications = [ ] ; return new discussion_list_renderer ( $ forum , $ rendererbase , $ this -> legacydatamapperfactory , $ this -> exporterfactory , $ this -> vaultfactory , $ this -> builderfactory , $ capabilitymanager , $ this -> urlfactory , $ template , $ notifications , function ( $ discussions , $ user , $ forum ) use ( $ capabilitymanager ) { $ exportedpostsbuilder = $ this -> builderfactory -> get_exported_posts_builder ( ) ; $ discussionentries = [ ] ; $ postentries = [ ] ; foreach ( $ discussions as $ discussion ) { $ discussionentries [ ] = $ discussion -> get_discussion ( ) ; $ discussionentriesids [ ] = $ discussion -> get_discussion ( ) -> get_id ( ) ; $ postentries [ ] = $ discussion -> get_first_post ( ) ; } $ exportedposts [ 'posts' ] = $ exportedpostsbuilder -> build ( $ user , [ $ forum ] , $ discussionentries , $ postentries ) ; $ postvault = $ this -> vaultfactory -> get_post_vault ( ) ; $ canseeanyprivatereply = $ capabilitymanager -> can_view_any_private_reply ( $ user ) ; $ discussionrepliescount = $ postvault -> get_reply_count_for_discussion_ids ( $ user , $ discussionentriesids , $ canseeanyprivatereply ) ; array_walk ( $ exportedposts [ 'posts' ] , function ( $ post ) use ( $ discussionrepliescount ) { $ post -> discussionrepliescount = $ discussionrepliescount [ $ post -> discussionid ] ?? 0 ; // TODO: Find a better solution due to language differences when defining the singular and plural form. $ post -> isreplyplural = $ post -> discussionrepliescount != 1 ? true : false ; } ) ; $ exportedposts [ 'state' ] [ 'hasdiscussions' ] = $ exportedposts [ 'posts' ] ? true : false ; return $ exportedposts ; } ) ; }
docstring: Create a discussion list renderer which shows more information about the first post.
  
  @param forum_entity $forum The forum that the discussions belong to
  @param string $template The template to use
  @return discussion_list_renderer
docstring_tokens: Create a discussion list renderer which shows more information about the first post .