WordPress at a glance
function is not described

WP_REST_Users_Controller::get_user() protected WP 4.7.2

Get the user, if the ID is valid.

{} It's a method of the class: WP_REST_Users_Controller{}

No Hooks.

Return

WP_User/WP_Error. True if ID is valid, WP_Error otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_user( $id );
$id(int) (required)
Supplied ID.

Changelog

Since 4.7.2 Introduced.

Code of WP_REST_Users_Controller::get_user() WP 5.5.1

<?php
protected function get_user( $id ) {
	$error = new WP_Error(
		'rest_user_invalid_id',
		__( 'Invalid user ID.' ),
		array( 'status' => 404 )
	);

	if ( (int) $id <= 0 ) {
		return $error;
	}

	$user = get_userdata( (int) $id );
	if ( empty( $user ) || ! $user->exists() ) {
		return $error;
	}

	if ( is_multisite() && ! is_user_member_of_blog( $user->ID ) ) {
		return $error;
	}

	return $user;
}