original_string: public static function get_qtype($qtypename, $mustexist = true) {
          global $CFG;
          if (isset(self::$questiontypes[$qtypename])) {
              return self::$questiontypes[$qtypename];
          }
          $file = core_component::get_plugin_directory('qtype', $qtypename) . '/questiontype.php';
          if (!is_readable($file)) {
              if ($mustexist || $qtypename == 'missingtype') {
                  throw new coding_exception('Unknown question type ' . $qtypename);
              } else {
                  return self::get_qtype('missingtype');
              }
          }
          include_once($file);
          $class = 'qtype_' . $qtypename;
          if (!class_exists($class)) {
              throw new coding_exception("Class {$class} must be defined in {$file}.");
          }
          self::$questiontypes[$qtypename] = new $class();
          return self::$questiontypes[$qtypename];
      }
code: public static function get_qtype($qtypename, $mustexist = true) {
          global $CFG;
          if (isset(self::$questiontypes[$qtypename])) {
              return self::$questiontypes[$qtypename];
          }
          $file = core_component::get_plugin_directory('qtype', $qtypename) . '/questiontype.php';
          if (!is_readable($file)) {
              if ($mustexist || $qtypename == 'missingtype') {
                  throw new coding_exception('Unknown question type ' . $qtypename);
              } else {
                  return self::get_qtype('missingtype');
              }
          }
          include_once($file);
          $class = 'qtype_' . $qtypename;
          if (!class_exists($class)) {
              throw new coding_exception("Class {$class} must be defined in {$file}.");
          }
          self::$questiontypes[$qtypename] = new $class();
          return self::$questiontypes[$qtypename];
      }
code_tokens: public static function get_qtype ( $ qtypename , $ mustexist = true ) { global $ CFG ; if ( isset ( self :: $ questiontypes [ $ qtypename ] ) ) { return self :: $ questiontypes [ $ qtypename ] ; } $ file = core_component :: get_plugin_directory ( 'qtype' , $ qtypename ) . '/questiontype.php' ; if ( ! is_readable ( $ file ) ) { if ( $ mustexist || $ qtypename == 'missingtype' ) { throw new coding_exception ( 'Unknown question type ' . $ qtypename ) ; } else { return self :: get_qtype ( 'missingtype' ) ; } } include_once ( $ file ) ; $ class = 'qtype_' . $ qtypename ; if ( ! class_exists ( $ class ) ) { throw new coding_exception ( "Class {$class} must be defined in {$file}." ) ; } self :: $ questiontypes [ $ qtypename ] = new $ class ( ) ; return self :: $ questiontypes [ $ qtypename ] ; }
docstring: Get the question type class for a particular question type.
  @param string $qtypename the question type name. For example 'multichoice' or 'shortanswer'.
  @param bool $mustexist if false, the missing question type is returned when
  the requested question type is not installed.
  @return question_type the corresponding question type class.
docstring_tokens: Get the question type class for a particular question type .