original_string: public static function clean_data($user) {
          if (empty($user)) {
              return $user;
          }
  
          foreach ($user as $field => $value) {
              // Get the property parameter type and do the cleaning.
              try {
                  $user->$field = core_user::clean_field($value, $field);
              } catch (coding_exception $e) {
                  debugging("The property '$field' could not be cleaned.", DEBUG_DEVELOPER);
              }
          }
  
          return $user;
      }
code: public static function clean_data($user) {
          if (empty($user)) {
              return $user;
          }
  
          foreach ($user as $field => $value) {
              // Get the property parameter type and do the cleaning.
              try {
                  $user->$field = core_user::clean_field($value, $field);
              } catch (coding_exception $e) {
                  debugging("The property '$field' could not be cleaned.", DEBUG_DEVELOPER);
              }
          }
  
          return $user;
      }
code_tokens: public static function clean_data ( $ user ) { if ( empty ( $ user ) ) { return $ user ; } foreach ( $ user as $ field => $ value ) { // Get the property parameter type and do the cleaning. try { $ user -> $ field = core_user :: clean_field ( $ value , $ field ) ; } catch ( coding_exception $ e ) { debugging ( "The property '$field' could not be cleaned." , DEBUG_DEVELOPER ) ; } } return $ user ; }
docstring: Clean the user data.
  
  @param stdClass|array $user the user data to be validated against properties definition.
  @return stdClass $user the cleaned user data.
docstring_tokens: Clean the user data .