Code Duplication    Length = 9-12 lines in 3 locations

projects/packages/sync/src/modules/class-terms.php 1 location

@@ 156-164 (lines=9) @@
153
	 * @param array $config Full sync configuration for this sync module.
154
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
155
	 */
156
	public function get_where_sql( $config ) {
157
		$where_sql = Settings::get_blacklisted_taxonomies_sql();
158
159
		if ( is_array( $config ) ) {
160
			$where_sql .= ' AND term_taxonomy_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
161
		}
162
163
		return $where_sql;
164
	}
165
166
	/**
167
	 * Retrieve an estimated number of actions that will be enqueued.

projects/packages/sync/src/modules/class-users.php 1 location

@@ 665-676 (lines=12) @@
662
	 * @param array $config Full sync configuration for this sync module.
663
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
664
	 */
665
	public function get_where_sql( $config ) {
666
		global $wpdb;
667
668
		$query = "meta_key = '{$wpdb->prefix}capabilities'";
669
670
		// The $config variable is a list of user IDs to sync.
671
		if ( is_array( $config ) ) {
672
			$query .= ' AND user_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
673
		}
674
675
		return $query;
676
	}
677
678
	/**
679
	 * Retrieve the actions that will be sent for this module during a full sync.

projects/packages/sync/src/modules/class-posts.php 1 location

@@ 271-280 (lines=10) @@
268
	 * @param array $config Full sync configuration for this sync module.
269
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
270
	 */
271
	public function get_where_sql( $config ) {
272
		$where_sql = Settings::get_blacklisted_post_types_sql();
273
274
		// Config is a list of post IDs to sync.
275
		if ( is_array( $config ) ) {
276
			$where_sql .= ' AND ID IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
277
		}
278
279
		return $where_sql;
280
	}
281
282
	/**
283
	 * Retrieve the actions that will be sent for this module during a full sync.