Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 132-147 (lines=16) @@
129
			$query['meta_query'] = array( $meta );
130
		}
131
132
		if ( $args['sticky'] === 'include' ) {
133
			$query['ignore_sticky_posts'] = 1;
134
		} else if ( $args['sticky'] === 'exclude' ) {
135
			$sticky = get_option( 'sticky_posts' );
136
			if ( is_array( $sticky ) ) {
137
				$query['post__not_in'] = $sticky;
138
			}
139
		} else if ( $args['sticky'] === 'require' ) {
140
			$sticky = get_option( 'sticky_posts' );
141
			if ( is_array( $sticky ) && ! empty( $sticky ) ) {
142
				$query['post__in'] = $sticky;
143
			} else {
144
				// no sticky posts exist
145
				return array( 'found' => 0, 'posts' => array() );
146
			}
147
		}
148
149
		if ( isset( $args['exclude'] ) ) {
150
			$excluded_ids = (array) $args['exclude'];

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

@@ 134-149 (lines=16) @@
131
			$query['meta_query'] = array( $meta );
132
		}
133
134
		if ( $args['sticky'] === 'include' ) {
135
			$query['ignore_sticky_posts'] = 1;
136
		} else if ( $args['sticky'] === 'exclude' ) {
137
			$sticky = get_option( 'sticky_posts' );
138
			if ( is_array( $sticky ) ) {
139
				$query['post__not_in'] = $sticky;
140
			}
141
		} else if ( $args['sticky'] === 'require' ) {
142
			$sticky = get_option( 'sticky_posts' );
143
			if ( is_array( $sticky ) && ! empty( $sticky ) ) {
144
				$query['post__in'] = $sticky;
145
			} else {
146
				// no sticky posts exist
147
				return array( 'found' => 0, 'posts' => array() );
148
			}
149
		}
150
151
		if ( isset( $args['exclude'] ) ) {
152
			$excluded_ids = (array) $args['exclude'];