Code Duplication    Length = 8-8 lines in 2 locations

src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1 location

@@ 258-265 (lines=8) @@
255
256
		$comments = array();
257
258
		foreach ( $query_result as $comment ) {
259
			if ( ! $this->check_read_permission( $comment, $request ) ) {
260
				continue;
261
			}
262
263
			$data = $this->prepare_item_for_response( $comment, $request );
264
			$comments[] = $this->prepare_response_for_collection( $data );
265
		}
266
267
		$total_comments = (int) $query->found_comments;
268
		$max_pages      = (int) $query->max_num_pages;

src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1 location

@@ 306-313 (lines=8) @@
303
304
		$posts = array();
305
306
		foreach ( $query_result as $post ) {
307
			if ( ! $this->check_read_permission( $post ) ) {
308
				continue;
309
			}
310
311
			$data    = $this->prepare_item_for_response( $post, $request );
312
			$posts[] = $this->prepare_response_for_collection( $data );
313
		}
314
315
		// Reset filter.
316
		if ( 'edit' === $request['context'] ) {