Code Duplication    Length = 21-21 lines in 2 locations

projects/packages/sync/src/class-rest-sender.php 1 location

@@ 90-110 (lines=21) @@
87
	 *
88
	 * @return array Sync Actions to be returned to requestor
89
	 */
90
	public function immediate_full_sync_pull() {
91
		// try to give ourselves as much time as possible.
92
		set_time_limit( 0 );
93
94
		$original_send_data_cb = array( 'Automattic\Jetpack\Sync\Actions', 'send_data' );
95
		$temp_send_data_cb     = array( $this, 'jetpack_sync_send_data_listener' );
96
97
		Sender::get_instance()->set_enqueue_wait_time( 0 );
98
		remove_filter( 'jetpack_sync_send_data', $original_send_data_cb );
99
		add_filter( 'jetpack_sync_send_data', $temp_send_data_cb, 10, 6 );
100
		Sender::get_instance()->do_full_sync();
101
		remove_filter( 'jetpack_sync_send_data', $temp_send_data_cb );
102
		add_filter( 'jetpack_sync_send_data', $original_send_data_cb, 10, 6 );
103
104
		return array(
105
			'items'          => $this->items,
106
			'codec'          => Sender::get_instance()->get_codec()->name(),
107
			'sent_timestamp' => time(),
108
			'status'         => Actions::get_sync_status(),
109
		);
110
	}
111
112
	/**
113
	 * Checkout items out of the sync queue.

projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-sync-endpoint.php 1 location

@@ 319-339 (lines=21) @@
316
	 *
317
	 * @return array Sync Actions to be returned to requestor
318
	 */
319
	public function immediate_full_sync_pull( $number_of_items = null ) {
320
		// try to give ourselves as much time as possible.
321
		set_time_limit( 0 );
322
323
		$original_send_data_cb = array( 'Automattic\Jetpack\Sync\Actions', 'send_data' );
324
		$temp_send_data_cb     = array( $this, 'jetpack_sync_send_data_listener' );
325
326
		Sender::get_instance()->set_enqueue_wait_time( 0 );
327
		remove_filter( 'jetpack_sync_send_data', $original_send_data_cb );
328
		add_filter( 'jetpack_sync_send_data', $temp_send_data_cb, 10, 6 );
329
		Sender::get_instance()->do_full_sync();
330
		remove_filter( 'jetpack_sync_send_data', $temp_send_data_cb );
331
		add_filter( 'jetpack_sync_send_data', $original_send_data_cb, 10, 6 );
332
333
		return array(
334
			'items'          => $this->items,
335
			'codec'          => Sender::get_instance()->get_codec()->name(),
336
			'sent_timestamp' => time(),
337
			'status'         => Actions::get_sync_status(),
338
		);
339
	}
340
341
	protected function get_buffer( $queue, $number_of_items ) {
342
		$start = time();