original_string: protected static function get_chat_ids_to_cmids_from_cmids(array $cmids) {
          global $DB;
          list($insql, $inparams) = $DB->get_in_or_equal($cmids, SQL_PARAMS_NAMED);
          $sql = "
              SELECT c.id, cm.id AS cmid
                FROM {chat} c
                JOIN {modules} m
                  ON m.name = :chat
                JOIN {course_modules} cm
                  ON cm.instance = c.id
                 AND cm.module = m.id
               WHERE cm.id $insql";
          $params = array_merge($inparams, ['chat' => 'chat']);
          return $DB->get_records_sql_menu($sql, $params);
      }
code: protected static function get_chat_ids_to_cmids_from_cmids(array $cmids) {
          global $DB;
          list($insql, $inparams) = $DB->get_in_or_equal($cmids, SQL_PARAMS_NAMED);
          $sql = "
              SELECT c.id, cm.id AS cmid
                FROM {chat} c
                JOIN {modules} m
                  ON m.name = :chat
                JOIN {course_modules} cm
                  ON cm.instance = c.id
                 AND cm.module = m.id
               WHERE cm.id $insql";
          $params = array_merge($inparams, ['chat' => 'chat']);
          return $DB->get_records_sql_menu($sql, $params);
      }
code_tokens: protected static function get_chat_ids_to_cmids_from_cmids ( array $ cmids ) { global $ DB ; list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ cmids , SQL_PARAMS_NAMED ) ; $ sql = "
              SELECT c.id, cm.id AS cmid
                FROM {chat} c
                JOIN {modules} m
                  ON m.name = :chat
                JOIN {course_modules} cm
                  ON cm.instance = c.id
                 AND cm.module = m.id
               WHERE cm.id $insql" ; $ params = array_merge ( $ inparams , [ 'chat' => 'chat' ] ) ; return $ DB -> get_records_sql_menu ( $ sql , $ params ) ; }
docstring: Return a dict of chat IDs mapped to their course module ID.
  
  @param array $cmids The course module IDs.
  @return array In the form of [$chatid => $cmid].
docstring_tokens: Return a dict of chat IDs mapped to their course module ID .