Code Duplication    Length = 9-12 lines in 3 locations

packages/sync/src/modules/Posts.php 1 location

@@ 97-106 (lines=10) @@
94
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
95
	}
96
97
	private function get_where_sql( $config ) {
98
		$where_sql = Settings::get_blacklisted_post_types_sql();
99
100
		// config is a list of post IDs to sync
101
		if ( is_array( $config ) ) {
102
			$where_sql .= ' AND ID IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
103
		}
104
105
		return $where_sql;
106
	}
107
108
	function get_full_sync_actions() {
109
		return array( 'jetpack_full_sync_posts' );

packages/sync/src/modules/Users.php 1 location

@@ 407-418 (lines=12) @@
404
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
405
	}
406
407
	private function get_where_sql( $config ) {
408
		global $wpdb;
409
410
		$query = "meta_key = '{$wpdb->prefix}capabilities'";
411
412
		// config is a list of user IDs to sync
413
		if ( is_array( $config ) ) {
414
			$query .= ' AND user_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
415
		}
416
417
		return $query;
418
	}
419
420
	function get_full_sync_actions() {
421
		return array( 'jetpack_full_sync_users' );

packages/sync/src/modules/Terms.php 1 location

@@ 58-66 (lines=9) @@
55
		return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_terms', $wpdb->term_taxonomy, 'term_taxonomy_id', $this->get_where_sql( $config ), $max_items_to_enqueue, $state );
56
	}
57
58
	private function get_where_sql( $config ) {
59
		$where_sql = Settings::get_blacklisted_taxonomies_sql();
60
61
		if ( is_array( $config ) ) {
62
			$where_sql .= ' AND term_taxonomy_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
63
		}
64
65
		return $where_sql;
66
	}
67
68
	public function estimate_full_sync_actions( $config ) {
69
		global $wpdb;