original_string: public static function create($quizid, $userid = null) {
          global $DB;
  
          $quiz = quiz_access_manager::load_quiz_and_settings($quizid);
          $course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
          $cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id, false, MUST_EXIST);
  
          // Update quiz with override information.
          if ($userid) {
              $quiz = quiz_update_effective_access($quiz, $userid);
          }
  
          return new quiz($quiz, $cm, $course);
      }
code: public static function create($quizid, $userid = null) {
          global $DB;
  
          $quiz = quiz_access_manager::load_quiz_and_settings($quizid);
          $course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
          $cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id, false, MUST_EXIST);
  
          // Update quiz with override information.
          if ($userid) {
              $quiz = quiz_update_effective_access($quiz, $userid);
          }
  
          return new quiz($quiz, $cm, $course);
      }
code_tokens: public static function create ( $ quizid , $ userid = null ) { global $ DB ; $ quiz = quiz_access_manager :: load_quiz_and_settings ( $ quizid ) ; $ course = $ DB -> get_record ( 'course' , array ( 'id' => $ quiz -> course ) , '*' , MUST_EXIST ) ; $ cm = get_coursemodule_from_instance ( 'quiz' , $ quiz -> id , $ course -> id , false , MUST_EXIST ) ; // Update quiz with override information. if ( $ userid ) { $ quiz = quiz_update_effective_access ( $ quiz , $ userid ) ; } return new quiz ( $ quiz , $ cm , $ course ) ; }
docstring: Static function to create a new quiz object for a specific user.
  
  @param int $quizid the the quiz id.
  @param int $userid the the userid.
  @return quiz the new quiz object
docstring_tokens: Static function to create a new quiz object for a specific user .