Code Duplication    Length = 3-3 lines in 3 locations

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

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

@@ 348-350 (lines=3) @@
345
		);
346
347
		// Checks for errors.
348
		if ( false === $update ) {
349
			return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Could not edit the attribute', 'woocommerce' ), array( 'status' => 400 ) );
350
		}
351
352
		$attribute = $this->get_attribute( $id );
353
@@ 410-412 (lines=3) @@
407
			array( '%d' )
408
		);
409
410
		if ( false === $deleted ) {
411
			return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) );
412
		}
413
414
		$taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
415