Code Duplication    Length = 10-10 lines in 2 locations

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

@@ 70-79 (lines=10) @@
67
	 * @param  WP_REST_Request $request Full details about the request.
68
	 * @return WP_Error|boolean
69
	 */
70
	public function get_items_permissions_check( $request ) {
71
72
		$post_type = get_post_type_object( $this->post_type );
73
74
		if ( 'edit' === $request['context'] && ! current_user_can( $post_type->cap->edit_posts ) ) {
75
			return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit these posts in this post type' ), array( 'status' => rest_authorization_required_code() ) );
76
		}
77
78
		return true;
79
	}
80
81
	/**
82
	 * Get a collection of posts.
@@ 1823-1832 (lines=10) @@
1820
	 * @param  string $parameter
1821
	 * @return WP_Error|boolean
1822
	 */
1823
	public function validate_user_can_query_private_statuses( $value, $request, $parameter ) {
1824
		if ( 'publish' === $value ) {
1825
			return true;
1826
		}
1827
		$post_type_obj = get_post_type_object( $this->post_type );
1828
		if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
1829
			return true;
1830
		}
1831
		return new WP_Error( 'rest_forbidden_status', __( 'Status is forbidden' ), array( 'status' => rest_authorization_required_code() ) );
1832
	}
1833
}
1834