Code Duplication    Length = 10-11 lines in 2 locations

packages/sync/src/modules/class-posts.php 2 locations

@@ 477-486 (lines=10) @@
474
475
		// Return non existant post.
476
		$post_type = get_post_type_object( $post->post_type );
477
		if ( empty( $post_type ) || ! is_object( $post_type ) ) {
478
			$non_existant_post                    = new \stdClass();
479
			$non_existant_post->ID                = $post->ID;
480
			$non_existant_post->post_modified     = $post->post_modified;
481
			$non_existant_post->post_modified_gmt = $post->post_modified_gmt;
482
			$non_existant_post->post_status       = 'jetpack_sync_non_registered_post_type';
483
			$non_existant_post->post_type         = $post->post_type;
484
485
			return $non_existant_post;
486
		}
487
		/**
488
		 * Filters whether to prevent sending post data to .com
489
		 *
@@ 501-511 (lines=11) @@
498
		 * @param boolean false prevent post data from being synced to WordPress.com
499
		 * @param mixed $post \WP_Post object
500
		 */
501
		if ( apply_filters( 'jetpack_sync_prevent_sending_post_data', false, $post ) ) {
502
			// We only send the bare necessary object to be able to create a checksum.
503
			$blocked_post                    = new \stdClass();
504
			$blocked_post->ID                = $post->ID;
505
			$blocked_post->post_modified     = $post->post_modified;
506
			$blocked_post->post_modified_gmt = $post->post_modified_gmt;
507
			$blocked_post->post_status       = 'jetpack_sync_blocked';
508
			$blocked_post->post_type         = $post->post_type;
509
510
			return $blocked_post;
511
		}
512
513
		// lets not do oembed just yet.
514
		$this->remove_embed();