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;
    }
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;
    }
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 ; }
Clean the user data.

@param stdClass|array $user the user data to be validated against properties definition.
@return stdClass $user the cleaned user data.
Clean the user data .