Code Duplication    Length = 10-10 lines in 2 locations

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

@@ 76-85 (lines=10) @@
73
	 * @param  WP_REST_Request $request Full details about the request.
74
	 * @return WP_Error|boolean
75
	 */
76
	public function get_items_permissions_check( $request ) {
77
		$tax_obj = get_taxonomy( $this->taxonomy );
78
		if ( ! $tax_obj || ! $this->check_is_taxonomy_allowed( $this->taxonomy ) ) {
79
			return false;
80
		}
81
		if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
82
			return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannot view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
83
		}
84
		return true;
85
	}
86
87
	/**
88
	 * Get terms associated with a taxonomy
@@ 276-285 (lines=10) @@
273
	 * @param  WP_REST_Request $request Full details about the request.
274
	 * @return WP_Error|boolean
275
	 */
276
	public function get_item_permissions_check( $request ) {
277
		$tax_obj = get_taxonomy( $this->taxonomy );
278
		if ( ! $tax_obj || ! $this->check_is_taxonomy_allowed( $this->taxonomy ) ) {
279
			return false;
280
		}
281
		if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
282
			return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannot view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
283
		}
284
		return true;
285
	}
286
287
	/**
288
	 * Get a single term from a taxonomy