original_string: protected static function validate_assign($assignid) {
          global $DB;
  
          // Request and permission validation.
          $assign = $DB->get_record('assign', array('id' => $assignid), 'id', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($assign, 'assign');
  
          $context = context_module::instance($cm->id);
          // Please, note that is not required to check mod/assign:view because is done by validate_context->require_login.
          self::validate_context($context);
          $assign = new assign($context, $cm, $course);
  
          return array($assign, $course, $cm, $context);
      }
code: protected static function validate_assign($assignid) {
          global $DB;
  
          // Request and permission validation.
          $assign = $DB->get_record('assign', array('id' => $assignid), 'id', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($assign, 'assign');
  
          $context = context_module::instance($cm->id);
          // Please, note that is not required to check mod/assign:view because is done by validate_context->require_login.
          self::validate_context($context);
          $assign = new assign($context, $cm, $course);
  
          return array($assign, $course, $cm, $context);
      }
code_tokens: protected static function validate_assign ( $ assignid ) { global $ DB ; // Request and permission validation. $ assign = $ DB -> get_record ( 'assign' , array ( 'id' => $ assignid ) , 'id' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ assign , 'assign' ) ; $ context = context_module :: instance ( $ cm -> id ) ; // Please, note that is not required to check mod/assign:view because is done by validate_context->require_login. self :: validate_context ( $ context ) ; $ assign = new assign ( $ context , $ cm , $ course ) ; return array ( $ assign , $ course , $ cm , $ context ) ; }
docstring: Utility function for validating an assign.
  
  @param int $assignid assign instance id
  @return array array containing the assign, course, context and course module objects
  @since  Moodle 3.2
docstring_tokens: Utility function for validating an assign .