Code Duplication    Length = 12-14 lines in 2 locations

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

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

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

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