Code Duplication    Length = 13-14 lines in 2 locations

projects/plugins/jetpack/tests/php/sync/server/class.jetpack-sync-test-replicastore.php 2 locations

@@ 71-83 (lines=13) @@
68
		return count( $this->get_posts( $status, $min_id, $max_id ) );
69
	}
70
71
	function get_posts( $status = null, $min_id = null, $max_id = null ) {
72
		$this->post_status[ get_current_blog_id() ] = $status;
73
74
		$posts = array_filter( array_values( $this->posts[ get_current_blog_id() ] ), array( $this, 'filter_post_status' ) );
75
76
		foreach ( $posts as $i => $post ) {
77
			if ( ( $min_id && $post->ID < $min_id ) || ( $max_id && $post->ID > $max_id ) ) {
78
				unset( $posts[ $i ] );
79
			}
80
		}
81
82
		return array_values( $posts );
83
	}
84
85
	function posts_checksum( $min_id = null, $max_id = null ) {
86
		return $this->calculate_checksum( $this->posts[ get_current_blog_id() ], 'ID', $min_id, $max_id, Defaults::$default_post_checksum_columns );
@@ 116-129 (lines=14) @@
113
		return count( $this->get_comments( $status, $min_id, $max_id ) );
114
	}
115
116
	function get_comments( $status = null, $min_id = null, $max_id = null ) {
117
		$this->comment_status[ get_current_blog_id() ] = $status;
118
119
		// valid statuses: 'hold', 'approve', 'spam', 'trash', or 'post-trashed.
120
		$comments = array_filter( array_values( $this->comments[ get_current_blog_id() ] ), array( $this, 'filter_comment_status' ) );
121
122
		foreach ( $comments as $i => $comment ) {
123
			if ( $min_id && $comment->comment_ID < $min_id || $max_id && $comment->comment_ID > $max_id ) {
124
				unset( $comments[ $i ] );
125
			}
126
		}
127
128
		return array_values( $comments );
129
	}
130
131
	function comments_checksum( $min_id = null, $max_id = null ) {
132
		return $this->calculate_checksum( array_filter( $this->comments[ get_current_blog_id() ], array( $this, 'is_not_spam' ) ), 'comment_ID', $min_id, $max_id, Defaults::$default_comment_checksum_columns );