Code Duplication    Length = 3-3 lines in 2 locations

lib/endpoints/class-wp-rest-comments-controller.php 2 locations

@@ 235-237 (lines=3) @@
232
233
		$post = $this->get_post( $comment->comment_post_ID );
234
235
		if ( $post && ! $this->check_read_post_permission( $post ) ) {
236
			return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannot read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
237
		}
238
239
		if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) {
240
			return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannot view this comment with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
@@ 298-300 (lines=3) @@
295
296
		if ( ! empty( $request['post'] ) && $post = $this->get_post( (int) $request['post'] ) ) {
297
298
			if ( ! $this->check_read_post_permission( $post ) ) {
299
				return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannot read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
300
			}
301
302
			if ( ! comments_open( $post->ID ) ) {
303
				return new WP_Error( 'rest_comment_closed', __( 'Sorry, comments are closed on this post.' ), array( 'status' => 403 ) );