Code Duplication    Length = 9-9 lines in 2 locations

json-endpoints/class.wpcom-json-api-site-user-endpoint.php 1 location

@@ 54-62 (lines=9) @@
51
		}
52
	}
53
54
	public function get_user( $user_id ) {
55
		$the_user = $this->get_author( $user_id, true );
56
		if ( $the_user && ! is_wp_error( $the_user ) ) {
57
			$userdata = get_userdata( $user_id );
58
			$the_user->roles = ! is_wp_error( $userdata ) ? $userdata->roles : array();
59
		}
60
61
		return $the_user;
62
	}
63
64
	/**
65
	 * Updates user data

json-endpoints/jetpack/class.jetpack-json-api-user-create-endpoint.php 1 location

@@ 44-52 (lines=9) @@
41
		return $this->get_user( $user->ID );
42
	}
43
44
	public function get_user( $user_id ) {
45
		$the_user = $this->get_author( $user_id, true );
46
		if ( $the_user && ! is_wp_error( $the_user ) ) {
47
			$userdata = get_userdata( $user_id );
48
			$the_user->roles = ! is_wp_error( $userdata ) ? $userdata->roles : array();
49
		}
50
51
		return $the_user;
52
	}
53
54
}
55