Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 205-223 (lines=19) @@
202
			$query['meta_query'] = array( $meta );
203
		}
204
205
		if ( $args['sticky'] === 'include' ) {
206
			$query['ignore_sticky_posts'] = 1;
207
		} elseif ( $args['sticky'] === 'exclude' ) {
208
			$sticky = get_option( 'sticky_posts' );
209
			if ( is_array( $sticky ) ) {
210
				$query['post__not_in'] = $sticky;
211
			}
212
		} elseif ( $args['sticky'] === 'require' ) {
213
			$sticky = get_option( 'sticky_posts' );
214
			if ( is_array( $sticky ) && ! empty( $sticky ) ) {
215
				$query['post__in'] = $sticky;
216
			} else {
217
				// no sticky posts exist
218
				return array(
219
					'found' => 0,
220
					'posts' => array(),
221
				);
222
			}
223
		}
224
225
		if ( isset( $args['exclude'] ) ) {
226
			$excluded_ids          = (array) $args['exclude'];

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

@@ 199-217 (lines=19) @@
196
			$query['meta_query'] = array( $meta );
197
		}
198
199
		if ( $args['sticky'] === 'include' ) {
200
			$query['ignore_sticky_posts'] = 1;
201
		} elseif ( $args['sticky'] === 'exclude' ) {
202
			$sticky = get_option( 'sticky_posts' );
203
			if ( is_array( $sticky ) ) {
204
				$query['post__not_in'] = $sticky;
205
			}
206
		} elseif ( $args['sticky'] === 'require' ) {
207
			$sticky = get_option( 'sticky_posts' );
208
			if ( is_array( $sticky ) && ! empty( $sticky ) ) {
209
				$query['post__in'] = $sticky;
210
			} else {
211
				// no sticky posts exist
212
				return array(
213
					'found' => 0,
214
					'posts' => array(),
215
				);
216
			}
217
		}
218
219
		if ( isset( $args['exclude'] ) ) {
220
			$excluded_ids          = (array) $args['exclude'];