protected function do_save( \WP_User $user ) {

		if ( ! $user->exists() ) {

			if ( empty( $user->user_pass ) ) {
				$user->user_pass = wp_generate_password( 24 );
			}

			$id = wp_insert_user( wp_slash( $user->to_array() ) );
		} else {
			$id = wp_update_user( wp_slash( $user->to_array() ) );
		}

		if ( is_wp_error( $id ) ) {
			throw new \InvalidArgumentException( 'Error encountered while saving WP_User: ' . $id->get_error_message() );
		}

		return get_user_by( 'id', $id );
	}
protected function do_save( \WP_User $user ) {

		if ( ! $user->exists() ) {

			if ( empty( $user->user_pass ) ) {
				$user->user_pass = wp_generate_password( 24 );
			}

			$id = wp_insert_user( wp_slash( $user->to_array() ) );
		} else {
			$id = wp_update_user( wp_slash( $user->to_array() ) );
		}

		if ( is_wp_error( $id ) ) {
			throw new \InvalidArgumentException( 'Error encountered while saving WP_User: ' . $id->get_error_message() );
		}

		return get_user_by( 'id', $id );
	}
protected function do_save ( \ WP_User $ user ) { if ( ! $ user -> exists ( ) ) { if ( empty ( $ user -> user_pass ) ) { $ user -> user_pass = wp_generate_password ( 24 ) ; } $ id = wp_insert_user ( wp_slash ( $ user -> to_array ( ) ) ) ; } else { $ id = wp_update_user ( wp_slash ( $ user -> to_array ( ) ) ) ; } if ( is_wp_error ( $ id ) ) { throw new \ InvalidArgumentException ( 'Error encountered while saving WP_User: ' . $ id -> get_error_message ( ) ) ; } return get_user_by ( 'id' , $ id ) ; }
Do the saving for a user.

@since 2.0

@param \WP_User $user

@return \WP_User
Do the saving for a user .