Code Duplication    Length = 9-12 lines in 3 locations

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

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

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

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

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

@@ 654-665 (lines=12) @@
651
	 * @param array $config Full sync configuration for this sync module.
652
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
653
	 */
654
	public function get_where_sql( $config ) {
655
		global $wpdb;
656
657
		$query = "meta_key = '{$wpdb->prefix}capabilities'";
658
659
		// The $config variable is a list of user IDs to sync.
660
		if ( is_array( $config ) ) {
661
			$query .= ' AND user_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
662
		}
663
664
		return $query;
665
	}
666
667
	/**
668
	 * Retrieve the actions that will be sent for this module during a full sync.