Code Duplication    Length = 8-8 lines in 2 locations

_inc/lib/class.core-rest-api-endpoints.php 2 locations

@@ 1062-1069 (lines=8) @@
1059
	public static function get_rewind_data() {
1060
		$rewind_data = self::rewind_data();
1061
1062
		if ( ! is_wp_error( $rewind_data ) ) {
1063
			return rest_ensure_response( array(
1064
					'code' => 'success',
1065
					'message' => esc_html__( 'Backup & Scan data correctly received.', 'jetpack' ),
1066
					'data' => wp_json_encode( $rewind_data ),
1067
				)
1068
			);
1069
		}
1070
1071
		if ( $rewind_data->get_error_code() === 'rewind_data_fetch_failed' ) {
1072
			return new WP_Error( 'rewind_data_fetch_failed', esc_html__( 'Failed fetching rewind data. Try again later.', 'jetpack' ), array( 'status' => 400 ) );
@@ 1358-1365 (lines=8) @@
1355
	public static function get_site_data() {
1356
		$site_data = self::site_data();
1357
1358
		if ( ! is_wp_error( $site_data ) ) {
1359
			return rest_ensure_response( array(
1360
					'code' => 'success',
1361
					'message' => esc_html__( 'Site data correctly received.', 'jetpack' ),
1362
					'data' => json_encode( $site_data ),
1363
				)
1364
			);
1365
		}
1366
		if ( $site_data->get_error_code() === 'site_data_fetch_failed' ) {
1367
			return new WP_Error( 'site_data_fetch_failed', esc_html__( 'Failed fetching site data. Try again later.', 'jetpack' ), array( 'status' => 400 ) );
1368
		}