Code Duplication    Length = 16-16 lines in 3 locations

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

@@ 605-620 (lines=16) @@
602
		// WPCOM Specific (Jetpack's will get bumped elsewhere
603
		// Tracks how many posts are published and sets meta
604
		// so we can track some other cool stats (like likes & comments on posts published)
605
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
606
			if (
607
				( $new && 'publish' == $input['status'] )
608
				|| (
609
					! $new && isset( $last_status )
610
					&& 'publish' != $last_status
611
					&& isset( $new_status )
612
					&& 'publish' == $new_status
613
				)
614
			) {
615
				/** This action is documented in modules/widgets/social-media-icons.php */
616
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
617
				update_post_meta( $post_id, '_rest_api_published', 1 );
618
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
619
			}
620
		}
621
622
623
		// 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-1-endpoint.php 1 location

@@ 678-693 (lines=16) @@
675
		// WPCOM Specific (Jetpack's will get bumped elsewhere
676
		// Tracks how many posts are published and sets meta
677
		// so we can track some other cool stats (like likes & comments on posts published)
678
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
679
			if (
680
				( $new && 'publish' == $input['status'] )
681
				|| (
682
					! $new && isset( $last_status )
683
					&& 'publish' != $last_status
684
					&& isset( $new_status )
685
					&& 'publish' == $new_status
686
				)
687
			) {
688
				/** This action is documented in modules/widgets/social-media-icons.php */
689
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
690
				update_post_meta( $post_id, '_rest_api_published', 1 );
691
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
692
			}
693
		}
694
695
696
		// 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

@@ 649-664 (lines=16) @@
646
		// WPCOM Specific (Jetpack's will get bumped elsewhere
647
		// Tracks how many posts are published and sets meta
648
		// so we can track some other cool stats (like likes & comments on posts published)
649
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
650
			if (
651
				( $new && 'publish' == $input['status'] )
652
				|| (
653
					!$new && isset( $last_status )
654
					&& 'publish' != $last_status
655
					&& isset( $new_status )
656
					&& 'publish' == $new_status
657
				)
658
			) {
659
				/** This action is documented in modules/widgets/social-media-icons.php */
660
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
661
				update_post_meta( $post_id, '_rest_api_published', 1 );
662
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
663
			}
664
		}
665
666
667
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us