Code Duplication    Length = 3-3 lines in 4 locations

includes/abstracts/abstract-wc-rest-controller.php 1 location

@@ 63-65 (lines=3) @@
60
			$total += count( $items['delete'] );
61
		}
62
63
		if ( $total > $limit ) {
64
			return new WP_Error( 'woocommerce_rest_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), array( 'status' => 413 ) );
65
		}
66
67
		return true;
68
	}

includes/api/class-wc-rest-product-attributes-controller.php 2 locations

@@ 338-340 (lines=3) @@
335
		);
336
337
		// Checks for errors.
338
		if ( false === $update ) {
339
			return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Could not edit the attribute', 'woocommerce' ), array( 'status' => 400 ) );
340
		}
341
342
		$attribute = $this->get_attribute( $id );
343
@@ 400-402 (lines=3) @@
397
			array( '%d' )
398
		);
399
400
		if ( false === $deleted ) {
401
			return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) );
402
		}
403
404
		$taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
405

includes/api/class-wc-rest-authentication.php 1 location

@@ 300-302 (lines=3) @@
297
298
		$valid_window = 15 * 60; // 15 minute window.
299
300
		if ( ( $timestamp < time() - $valid_window ) || ( $timestamp > time() + $valid_window ) ) {
301
			return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid timestamp.', 'woocommerce' ), array( 'status' => 401 ) );
302
		}
303
304
		$used_nonces = maybe_unserialize( $user->nonces );
305