original_string: private function revokeMembership($user)
      {
          try {
  
              foreach($user->membershipList as $group) {
                  if ($group->resync_on_login) {
                      $user->membershipList()->detach($group);
                  }
              }
  
          } catch (\Exception $ex) {
              Log::error('Exception revoking local group membership for user: ' . $user->username . ', Exception message: ' . $ex->getMessage());
              Log::error($ex->getTraceAsString());
          }
  
      }
code: private function revokeMembership($user)
      {
          try {
  
              foreach($user->membershipList as $group) {
                  if ($group->resync_on_login) {
                      $user->membershipList()->detach($group);
                  }
              }
  
          } catch (\Exception $ex) {
              Log::error('Exception revoking local group membership for user: ' . $user->username . ', Exception message: ' . $ex->getMessage());
              Log::error($ex->getTraceAsString());
          }
  
      }
code_tokens: private function revokeMembership ( $ user ) { try { foreach ( $ user -> membershipList as $ group ) { if ( $ group -> resync_on_login ) { $ user -> membershipList ( ) -> detach ( $ group ) ; } } } catch ( \ Exception $ ex ) { Log :: error ( 'Exception revoking local group membership for user: ' . $ user -> username . ', Exception message: ' . $ ex -> getMessage ( ) ) ; Log :: error ( $ ex -> getTraceAsString ( ) ) ; } }
docstring: Revoke membership to all local group that are marked with
  'resync_on_login' as 1 or true.
  
  @param $user The user to revoke group membership from.
docstring_tokens: Revoke membership to all local group that are marked with resync_on_login as 1 or true .