Code Duplication    Length = 8-8 lines in 2 locations

projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-sync-endpoint.php 1 location

@@ 421-428 (lines=8) @@
418
		);
419
	}
420
421
	protected static function sanitize_item_ids( $item ) {
422
		// lets not delete any options that don't start with jpsq_sync-
423
		if ( ! is_string( $item ) || substr( $item, 0, 5 ) !== 'jpsq_' ) {
424
			return null;
425
		}
426
		//Limit to A-Z,a-z,0-9,_,-,.
427
		return preg_replace( '/[^A-Za-z0-9-_.]/', '', $item );
428
	}
429
}
430
431
class Jetpack_JSON_API_Sync_Unlock_Endpoint extends Jetpack_JSON_API_Sync_Endpoint {

projects/packages/sync/src/class-rest-endpoints.php 1 location

@@ 771-778 (lines=8) @@
768
	 *
769
	 * @return string|string[]|null
770
	 */
771
	protected static function sanitize_item_ids( $item ) {
772
		// lets not delete any options that don't start with jpsq_sync- .
773
		if ( ! is_string( $item ) || substr( $item, 0, 5 ) !== 'jpsq_' ) {
774
			return null;
775
		}
776
		// Limit to A-Z,a-z,0-9,_,-,. .
777
		return preg_replace( '/[^A-Za-z0-9-_.]/', '', $item );
778
	}
779
780
}
781