Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 1228-1244 (lines=17) @@
1225
		);
1226
	}
1227
1228
	public static function rewind_data() {
1229
		$site_id = Jetpack_Options::get_option( 'id' );
1230
1231
		if ( ! $site_id ) {
1232
			return new WP_Error( 'site_id_missing' );
1233
		}
1234
1235
		$response = Client::wpcom_json_api_request_as_blog( sprintf( '/sites/%d/rewind', $site_id ) .'?force=wpcom', '2', array(), null, 'wpcom' );
1236
1237
		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
1238
			return new WP_Error( 'rewind_data_fetch_failed' );
1239
		}
1240
1241
		$body = wp_remote_retrieve_body( $response );
1242
1243
		return json_decode( $body );
1244
	}
1245
1246
	/**
1247
	 * Get rewind data
@@ 1287-1303 (lines=17) @@
1284
	 *
1285
	 * @return array|WP_Error Result from WPCOM API or error.
1286
	 */
1287
	public static function scan_state() {
1288
		$site_id = Jetpack_Options::get_option( 'id' );
1289
1290
		if ( ! $site_id ) {
1291
			return new WP_Error( 'site_id_missing' );
1292
		}
1293
1294
		$response = Client::wpcom_json_api_request_as_blog( sprintf( '/sites/%d/scan', $site_id ) . '?force=wpcom', '2', array(), null, 'wpcom' );
1295
1296
		if ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
1297
			return new WP_Error( 'scan_state_fetch_failed' );
1298
		}
1299
1300
		$body = wp_remote_retrieve_body( $response );
1301
1302
		return json_decode( $body );
1303
	}
1304
1305
	/**
1306
	 * Get Scan state for API.