original_string: public function get_from_forum_id_and_group_id(
          int $forumid,
          array $groupids,
          bool $includehiddendiscussions,
          ?int $includepostsforuser,
          ?int $sortorder,
          int $limit,
          int $offset
      ) {
          $alias = $this->get_table_alias();
  
          $wheresql = "{$alias}.forum = :forumid AND ";
          $groupparams = [];
          if (empty($groupids)) {
              $wheresql .= "{$alias}.groupid = :allgroupsid";
          } else {
              list($insql, $groupparams) = $this->get_db()->get_in_or_equal($groupids, SQL_PARAMS_NAMED, 'gid');
              $wheresql .= "({$alias}.groupid = :allgroupsid OR {$alias}.groupid {$insql})";
          }
  
          [
              'wheresql' => $hiddensql,
              'params' => $hiddenparams
          ] = $this->get_hidden_post_sql($includehiddendiscussions, $includepostsforuser);
          $wheresql .= $hiddensql;
  
          $params = array_merge($hiddenparams, $groupparams, [
              'forumid' => $forumid,
              'allgroupsid' => -1,
          ]);
  
          $includefavourites = $includepostsforuser ? true : false;
          $sql = $this->generate_get_records_sql($wheresql, $this->get_sort_order($sortorder, $includefavourites),
              $includepostsforuser);
          $records = $this->get_db()->get_records_sql($sql, $params, $offset, $limit);
  
          return $this->transform_db_records_to_entities($records);
      }
code: public function get_from_forum_id_and_group_id(
          int $forumid,
          array $groupids,
          bool $includehiddendiscussions,
          ?int $includepostsforuser,
          ?int $sortorder,
          int $limit,
          int $offset
      ) {
          $alias = $this->get_table_alias();
  
          $wheresql = "{$alias}.forum = :forumid AND ";
          $groupparams = [];
          if (empty($groupids)) {
              $wheresql .= "{$alias}.groupid = :allgroupsid";
          } else {
              list($insql, $groupparams) = $this->get_db()->get_in_or_equal($groupids, SQL_PARAMS_NAMED, 'gid');
              $wheresql .= "({$alias}.groupid = :allgroupsid OR {$alias}.groupid {$insql})";
          }
  
          [
              'wheresql' => $hiddensql,
              'params' => $hiddenparams
          ] = $this->get_hidden_post_sql($includehiddendiscussions, $includepostsforuser);
          $wheresql .= $hiddensql;
  
          $params = array_merge($hiddenparams, $groupparams, [
              'forumid' => $forumid,
              'allgroupsid' => -1,
          ]);
  
          $includefavourites = $includepostsforuser ? true : false;
          $sql = $this->generate_get_records_sql($wheresql, $this->get_sort_order($sortorder, $includefavourites),
              $includepostsforuser);
          $records = $this->get_db()->get_records_sql($sql, $params, $offset, $limit);
  
          return $this->transform_db_records_to_entities($records);
      }
code_tokens: public function get_from_forum_id_and_group_id ( int $ forumid , array $ groupids , bool $ includehiddendiscussions , ? int $ includepostsforuser , ? int $ sortorder , int $ limit , int $ offset ) { $ alias = $ this -> get_table_alias ( ) ; $ wheresql = "{$alias}.forum = :forumid AND " ; $ groupparams = [ ] ; if ( empty ( $ groupids ) ) { $ wheresql .= "{$alias}.groupid = :allgroupsid" ; } else { list ( $ insql , $ groupparams ) = $ this -> get_db ( ) -> get_in_or_equal ( $ groupids , SQL_PARAMS_NAMED , 'gid' ) ; $ wheresql .= "({$alias}.groupid = :allgroupsid OR {$alias}.groupid {$insql})" ; } [ 'wheresql' => $ hiddensql , 'params' => $ hiddenparams ] = $ this -> get_hidden_post_sql ( $ includehiddendiscussions , $ includepostsforuser ) ; $ wheresql .= $ hiddensql ; $ params = array_merge ( $ hiddenparams , $ groupparams , [ 'forumid' => $ forumid , 'allgroupsid' => - 1 , ] ) ; $ includefavourites = $ includepostsforuser ? true : false ; $ sql = $ this -> generate_get_records_sql ( $ wheresql , $ this -> get_sort_order ( $ sortorder , $ includefavourites ) , $ includepostsforuser ) ; $ records = $ this -> get_db ( ) -> get_records_sql ( $ sql , $ params , $ offset , $ limit ) ; return $ this -> transform_db_records_to_entities ( $ records ) ; }
docstring: Get each discussion, first post, first and last post author for the given forum, and the set of groups to display
  considering timed posts, and pagination.
  
  @param   int         $forumid The forum to fetch the discussion set for
  @param   int[]       $groupids The list of real groups to filter on
  @param   bool        $includehiddendiscussions Whether to include hidden discussions or not
  @param   int|null    $includepostsforuser Which user to include posts for, if any
  @param   int         $sortorder The sort order to use
  @param   int         $limit The number of discussions to fetch
  @param   int         $offset The record offset
  @return  array       The set of data fetched
docstring_tokens: Get each discussion first post first and last post author for the given forum and the set of groups to display considering timed posts and pagination .