Code Duplication    Length = 16-16 lines in 3 locations

json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php 1 location

@@ 416-431 (lines=16) @@
413
		// WPCOM Specific (Jetpack's will get bumped elsewhere
414
		// Tracks how many posts are published and sets meta
415
		// so we can track some other cool stats (like likes & comments on posts published)
416
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
417
			if (
418
				( $new && 'publish' == $input['status'] )
419
				|| (
420
					! $new && isset( $last_status )
421
					&& 'publish' != $last_status
422
					&& isset( $new_status )
423
					&& 'publish' == $new_status
424
				)
425
			) {
426
				/** This action is documented in modules/widgets/social-media-icons.php */
427
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
428
				update_post_meta( $post_id, '_rest_api_published', 1 );
429
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
430
			}
431
		}
432
433
434
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us

json-endpoints/class.wpcom-json-api-update-post-endpoint.php 1 location

@@ 403-418 (lines=16) @@
400
		// WPCOM Specific (Jetpack's will get bumped elsewhere
401
		// Tracks how many posts are published and sets meta
402
		// so we can track some other cool stats (like likes & comments on posts published)
403
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
404
			if (
405
				( $new && 'publish' == $input['status'] )
406
				|| (
407
					! $new && isset( $last_status )
408
					&& 'publish' != $last_status
409
					&& isset( $new_status )
410
					&& 'publish' == $new_status
411
				)
412
			) {
413
				/** This action is documented in modules/widgets/social-media-icons.php */
414
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
415
				update_post_meta( $post_id, '_rest_api_published', 1 );
416
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
417
			}
418
		}
419
420
421
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us

json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php 1 location

@@ 416-431 (lines=16) @@
413
		// WPCOM Specific (Jetpack's will get bumped elsewhere
414
		// Tracks how many posts are published and sets meta
415
		// so we can track some other cool stats (like likes & comments on posts published)
416
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
417
			if (
418
				( $new && 'publish' == $input['status'] )
419
				|| (
420
					!$new && isset( $last_status )
421
					&& 'publish' != $last_status
422
					&& isset( $new_status )
423
					&& 'publish' == $new_status
424
				)
425
			) {
426
				/** This action is documented in modules/widgets/social-media-icons.php */
427
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
428
				update_post_meta( $post_id, '_rest_api_published', 1 );
429
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
430
			}
431
		}
432
433
434
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us