Code Duplication    Length = 9-12 lines in 3 locations

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

@@ 126-134 (lines=9) @@
123
	 * @param array $config Full sync configuration for this sync module.
124
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
125
	 */
126
	private function get_where_sql( $config ) {
127
		$where_sql = Settings::get_blacklisted_taxonomies_sql();
128
129
		if ( is_array( $config ) ) {
130
			$where_sql .= ' AND term_taxonomy_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
131
		}
132
133
		return $where_sql;
134
	}
135
136
	/**
137
	 * Retrieve an estimated number of actions that will be enqueued.

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

@@ 643-654 (lines=12) @@
640
	 * @param array $config Full sync configuration for this sync module.
641
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
642
	 */
643
	private function get_where_sql( $config ) {
644
		global $wpdb;
645
646
		$query = "meta_key = '{$wpdb->prefix}capabilities'";
647
648
		// The $config variable is a list of user IDs to sync.
649
		if ( is_array( $config ) ) {
650
			$query .= ' AND user_id IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
651
		}
652
653
		return $query;
654
	}
655
656
	/**
657
	 * Retrieve the actions that will be sent for this module during a full sync.

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

@@ 225-234 (lines=10) @@
222
	 * @param array $config Full sync configuration for this sync module.
223
	 * @return string WHERE SQL clause, or `null` if no comments are specified in the module config.
224
	 */
225
	private function get_where_sql( $config ) {
226
		$where_sql = Settings::get_blacklisted_post_types_sql();
227
228
		// Config is a list of post IDs to sync.
229
		if ( is_array( $config ) ) {
230
			$where_sql .= ' AND ID IN (' . implode( ',', array_map( 'intval', $config ) ) . ')';
231
		}
232
233
		return $where_sql;
234
	}
235
236
	/**
237
	 * Retrieve the actions that will be sent for this module during a full sync.