original_string: protected static function user_not_supposed_to_be_here($instance, $ue, context_course $context, $plugin) {
          if (!$ue) {
              // Not enrolled yet - simple!
              return;
          }
  
          $userid = $ue->userid;
          $unenrolaction = $plugin->get_config('unenrolaction', ENROL_EXT_REMOVED_SUSPENDNOROLES);
  
          if ($unenrolaction == ENROL_EXT_REMOVED_UNENROL) {
              // Purges grades, group membership, preferences, etc. - admins were warned!
              $plugin->unenrol_user($instance, $userid);
  
          } else if ($unenrolaction == ENROL_EXT_REMOVED_SUSPEND) {
              if ($ue->status != ENROL_USER_SUSPENDED) {
                  $plugin->update_user_enrol($instance, $userid, ENROL_USER_SUSPENDED);
              }
  
          } else if ($unenrolaction == ENROL_EXT_REMOVED_SUSPENDNOROLES) {
              if ($ue->status != ENROL_USER_SUSPENDED) {
                  $plugin->update_user_enrol($instance, $userid, ENROL_USER_SUSPENDED);
              }
              role_unassign_all(array('userid'=>$userid, 'contextid'=>$context->id, 'component'=>'enrol_meta', 'itemid'=>$instance->id));
  
          } else {
              debugging('Unknown unenrol action '.$unenrolaction);
          }
      }
code: protected static function user_not_supposed_to_be_here($instance, $ue, context_course $context, $plugin) {
          if (!$ue) {
              // Not enrolled yet - simple!
              return;
          }
  
          $userid = $ue->userid;
          $unenrolaction = $plugin->get_config('unenrolaction', ENROL_EXT_REMOVED_SUSPENDNOROLES);
  
          if ($unenrolaction == ENROL_EXT_REMOVED_UNENROL) {
              // Purges grades, group membership, preferences, etc. - admins were warned!
              $plugin->unenrol_user($instance, $userid);
  
          } else if ($unenrolaction == ENROL_EXT_REMOVED_SUSPEND) {
              if ($ue->status != ENROL_USER_SUSPENDED) {
                  $plugin->update_user_enrol($instance, $userid, ENROL_USER_SUSPENDED);
              }
  
          } else if ($unenrolaction == ENROL_EXT_REMOVED_SUSPENDNOROLES) {
              if ($ue->status != ENROL_USER_SUSPENDED) {
                  $plugin->update_user_enrol($instance, $userid, ENROL_USER_SUSPENDED);
              }
              role_unassign_all(array('userid'=>$userid, 'contextid'=>$context->id, 'component'=>'enrol_meta', 'itemid'=>$instance->id));
  
          } else {
              debugging('Unknown unenrol action '.$unenrolaction);
          }
      }
code_tokens: protected static function user_not_supposed_to_be_here ( $ instance , $ ue , context_course $ context , $ plugin ) { if ( ! $ ue ) { // Not enrolled yet - simple! return ; } $ userid = $ ue -> userid ; $ unenrolaction = $ plugin -> get_config ( 'unenrolaction' , ENROL_EXT_REMOVED_SUSPENDNOROLES ) ; if ( $ unenrolaction == ENROL_EXT_REMOVED_UNENROL ) { // Purges grades, group membership, preferences, etc. - admins were warned! $ plugin -> unenrol_user ( $ instance , $ userid ) ; } else if ( $ unenrolaction == ENROL_EXT_REMOVED_SUSPEND ) { if ( $ ue -> status != ENROL_USER_SUSPENDED ) { $ plugin -> update_user_enrol ( $ instance , $ userid , ENROL_USER_SUSPENDED ) ; } } else if ( $ unenrolaction == ENROL_EXT_REMOVED_SUSPENDNOROLES ) { if ( $ ue -> status != ENROL_USER_SUSPENDED ) { $ plugin -> update_user_enrol ( $ instance , $ userid , ENROL_USER_SUSPENDED ) ; } role_unassign_all ( array ( 'userid' => $ userid , 'contextid' => $ context -> id , 'component' => 'enrol_meta' , 'itemid' => $ instance -> id ) ) ; } else { debugging ( 'Unknown unenrol action ' . $ unenrolaction ) ; } }
docstring: Deal with users that are not supposed to be enrolled via this instance
  @static
  @param stdClass $instance
  @param stdClass $ue
  @param context_course $context
  @param enrol_meta $plugin
  @return void
docstring_tokens: Deal with users that are not supposed to be enrolled via this instance