Code Duplication    Length = 9-12 lines in 3 locations

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.

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.

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

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