Code Duplication    Length = 9-11 lines in 2 locations

core/REST_API/Router.php 2 locations

@@ 396-404 (lines=9) @@
393
		if ( 0 < $post_id ) {
394
			$post = get_post( $post_id );
395
396
			if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
397
				return new \WP_Error(
398
					'block_cannot_read',
399
					__( 'Sorry, you are not allowed to read blocks of this post.', 'carbon-fields' ),
400
					array(
401
						'status' => rest_authorization_required_code(),
402
					)
403
				);
404
			}
405
		} else {
406
			if ( ! current_user_can( 'edit_posts' ) ) {
407
				return new \WP_Error(
@@ 405-415 (lines=11) @@
402
					)
403
				);
404
			}
405
		} else {
406
			if ( ! current_user_can( 'edit_posts' ) ) {
407
				return new \WP_Error(
408
					'block_cannot_read',
409
					__( 'Sorry, you are not allowed to read blocks as this user.', 'carbon-fields' ),
410
					array(
411
						'status' => rest_authorization_required_code(),
412
					)
413
				);
414
			}
415
		}
416
417
		return true;
418
	}