Code Duplication    Length = 16-16 lines in 2 locations

json-endpoints/class.wpcom-json-api-list-posts-v1-1-endpoint.php 1 location

@@ 190-205 (lines=16) @@
187
			$query['meta_query'] = array( $meta );
188
		}
189
190
		if ( $args['sticky'] === 'include' ) {
191
			$query['ignore_sticky_posts'] = 1;
192
		} else if ( $args['sticky'] === 'exclude' ) {
193
			$sticky = get_option( 'sticky_posts' );
194
			if ( is_array( $sticky ) ) {
195
				$query['post__not_in'] = $sticky;
196
			}
197
		} else if ( $args['sticky'] === 'require' ) {
198
			$sticky = get_option( 'sticky_posts' );
199
			if ( is_array( $sticky ) && ! empty( $sticky ) ) {
200
				$query['post__in'] = $sticky;
201
			} else {
202
				// no sticky posts exist
203
				return array( 'found' => 0, 'posts' => array() );
204
			}
205
		}
206
207
		if ( isset( $args['exclude'] ) ) {
208
			$excluded_ids = (array) $args['exclude'];

json-endpoints/class.wpcom-json-api-list-posts-v1-2-endpoint.php 1 location

@@ 183-198 (lines=16) @@
180
			$query['meta_query'] = array( $meta );
181
		}
182
183
		if ( $args['sticky'] === 'include' ) {
184
			$query['ignore_sticky_posts'] = 1;
185
		} else if ( $args['sticky'] === 'exclude' ) {
186
			$sticky = get_option( 'sticky_posts' );
187
			if ( is_array( $sticky ) ) {
188
				$query['post__not_in'] = $sticky;
189
			}
190
		} else if ( $args['sticky'] === 'require' ) {
191
			$sticky = get_option( 'sticky_posts' );
192
			if ( is_array( $sticky ) && ! empty( $sticky ) ) {
193
				$query['post__in'] = $sticky;
194
			} else {
195
				// no sticky posts exist
196
				return array( 'found' => 0, 'posts' => array() );
197
			}
198
		}
199
200
		if ( isset( $args['exclude'] ) ) {
201
			$excluded_ids = (array) $args['exclude'];