original_string: protected static function validate_quiz($quizid) {
          global $DB;
  
          // Request and permission validation.
          $quiz = $DB->get_record('quiz', array('id' => $quizid), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($quiz, 'quiz');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          return array($quiz, $course, $cm, $context);
      }
code: protected static function validate_quiz($quizid) {
          global $DB;
  
          // Request and permission validation.
          $quiz = $DB->get_record('quiz', array('id' => $quizid), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($quiz, 'quiz');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          return array($quiz, $course, $cm, $context);
      }
code_tokens: protected static function validate_quiz ( $ quizid ) { global $ DB ; // Request and permission validation. $ quiz = $ DB -> get_record ( 'quiz' , array ( 'id' => $ quizid ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ quiz , 'quiz' ) ; $ context = context_module :: instance ( $ cm -> id ) ; self :: validate_context ( $ context ) ; return array ( $ quiz , $ course , $ cm , $ context ) ; }
docstring: Utility function for validating a quiz.
  
  @param int $quizid quiz instance id
  @return array array containing the quiz, course, context and course module objects
  @since  Moodle 3.1
docstring_tokens: Utility function for validating a quiz .