Code Duplication    Length = 19-19 lines in 2 locations

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

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

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

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