Code Duplication    Length = 9-12 lines in 3 locations

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

@@ 244-253 (lines=10) @@
241
	 * @param array $config Full sync configuration for this sync module.
242
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
243
	 */
244
	public function get_where_sql( $config ) {
245
		$where_sql = Settings::get_blacklisted_post_types_sql();
246
247
		// Config is a list of post IDs to sync.
248
		if ( is_array( $config ) ) {
249
			$where_sql .= ' AND ID IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
250
		}
251
252
		return $where_sql;
253
	}
254
255
	/**
256
	 * Retrieve the actions that will be sent for this module during a full sync.

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

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

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

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