original_string: public static function get_message_processor($userid = 0, $name) {
          global $USER, $PAGE, $CFG;
  
          // Check if messaging is enabled.
          if (empty($CFG->messaging)) {
              throw new moodle_exception('disabled', 'message');
          }
  
          $params = self::validate_parameters(
              self::get_message_processor_parameters(),
              array(
                  'userid' => $userid,
                  'name' => $name,
              )
          );
  
          if (empty($params['userid'])) {
              $params['userid'] = $USER->id;
          }
  
          $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
          core_user::require_active_user($user);
          self::validate_context(context_user::instance($params['userid']));
  
          $processor = get_message_processor($params['name']);
  
          $processoroutput = new \core_message\output\processor($processor, $user);
          $renderer = $PAGE->get_renderer('core_message');
  
          return $processoroutput->export_for_template($renderer);
      }
code: public static function get_message_processor($userid = 0, $name) {
          global $USER, $PAGE, $CFG;
  
          // Check if messaging is enabled.
          if (empty($CFG->messaging)) {
              throw new moodle_exception('disabled', 'message');
          }
  
          $params = self::validate_parameters(
              self::get_message_processor_parameters(),
              array(
                  'userid' => $userid,
                  'name' => $name,
              )
          );
  
          if (empty($params['userid'])) {
              $params['userid'] = $USER->id;
          }
  
          $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
          core_user::require_active_user($user);
          self::validate_context(context_user::instance($params['userid']));
  
          $processor = get_message_processor($params['name']);
  
          $processoroutput = new \core_message\output\processor($processor, $user);
          $renderer = $PAGE->get_renderer('core_message');
  
          return $processoroutput->export_for_template($renderer);
      }
code_tokens: public static function get_message_processor ( $ userid = 0 , $ name ) { global $ USER , $ PAGE , $ CFG ; // Check if messaging is enabled. if ( empty ( $ CFG -> messaging ) ) { throw new moodle_exception ( 'disabled' , 'message' ) ; } $ params = self :: validate_parameters ( self :: get_message_processor_parameters ( ) , array ( 'userid' => $ userid , 'name' => $ name , ) ) ; if ( empty ( $ params [ 'userid' ] ) ) { $ params [ 'userid' ] = $ USER -> id ; } $ user = core_user :: get_user ( $ params [ 'userid' ] , '*' , MUST_EXIST ) ; core_user :: require_active_user ( $ user ) ; self :: validate_context ( context_user :: instance ( $ params [ 'userid' ] ) ) ; $ processor = get_message_processor ( $ params [ 'name' ] ) ; $ processoroutput = new \ core_message \ output \ processor ( $ processor , $ user ) ; $ renderer = $ PAGE -> get_renderer ( 'core_message' ) ; return $ processoroutput -> export_for_template ( $ renderer ) ; }
docstring: Get a message processor.
  
  @param int $userid
  @param string $name the name of the processor
  @return external_description
  @throws moodle_exception
  @since 3.2
docstring_tokens: Get a message processor .