Code Duplication    Length = 12-14 lines in 2 locations

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

@@ 343-354 (lines=12) @@
340
	 * @param array $config Full sync configuration for this all sync modules.
341
	 * @return array Array of range (min ID, max ID, total items) for all content types.
342
	 */
343
	private function get_content_range( $config ) {
344
		$range = array();
345
		// Only when we are sending the whole range do we want to send also the range.
346
		if ( true === isset( $config['posts'] ) && $config['posts'] ) {
347
			$range['posts'] = $this->get_range( 'posts' );
348
		}
349
350
		if ( true === isset( $config['comments'] ) && $config['comments'] ) {
351
			$range['comments'] = $this->get_range( 'comments' );
352
		}
353
		return $range;
354
	}
355
356
	/**
357
	 * Update the progress after sync modules actions have been processed on the server.

packages/sync/src/modules/class-full-sync-immediately.php 1 location

@@ 232-245 (lines=14) @@
229
	 *
230
	 * @return array Array of range (min ID, max ID, total items) for all content types.
231
	 */
232
	private function get_content_range() {
233
		$range  = array();
234
		$config = $this->get_status()['config'];
235
		// Add range only when syncing all objects.
236
		if ( true === isset( $config['posts'] ) && $config['posts'] ) {
237
			$range['posts'] = $this->get_range( 'posts' );
238
		}
239
240
		if ( true === isset( $config['comments'] ) && $config['comments'] ) {
241
			$range['comments'] = $this->get_range( 'comments' );
242
		}
243
244
		return $range;
245
	}
246
247
	/**
248
	 * Get the range (min ID, max ID and total items) of items to sync.