Code Duplication    Length = 12-14 lines in 2 locations

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

@@ 354-365 (lines=12) @@
351
	 * @param array $config Full sync configuration for this all sync modules.
352
	 * @return array Array of range (min ID, max ID, total items) for all content types.
353
	 */
354
	private function get_content_range( $config ) {
355
		$range = array();
356
		// Only when we are sending the whole range do we want to send also the range.
357
		if ( true === isset( $config['posts'] ) && $config['posts'] ) {
358
			$range['posts'] = $this->get_range( 'posts' );
359
		}
360
361
		if ( true === isset( $config['comments'] ) && $config['comments'] ) {
362
			$range['comments'] = $this->get_range( 'comments' );
363
		}
364
		return $range;
365
	}
366
367
	/**
368
	 * Update the progress after sync modules actions have been processed on the server.

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

@@ 265-278 (lines=14) @@
262
	 *
263
	 * @return array Array of range (min ID, max ID, total items) for all content types.
264
	 */
265
	private function get_content_range() {
266
		$range  = array();
267
		$config = $this->get_status()['config'];
268
		// Add range only when syncing all objects.
269
		if ( true === isset( $config['posts'] ) && $config['posts'] ) {
270
			$range['posts'] = $this->get_range( 'posts' );
271
		}
272
273
		if ( true === isset( $config['comments'] ) && $config['comments'] ) {
274
			$range['comments'] = $this->get_range( 'comments' );
275
		}
276
277
		return $range;
278
	}
279
280
	/**
281
	 * Get the range (min ID, max ID and total items) of items to sync.