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

@@ 362-364 (lines=3) @@
359
		);
360
361
		// Checks for errors.
362
		if ( false === $update ) {
363
			return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Could not edit the attribute', 'woocommerce' ), array( 'status' => 400 ) );
364
		}
365
366
		$attribute = $this->get_attribute( $id );
367
@@ 424-426 (lines=3) @@
421
			array( '%d' )
422
		);
423
424
		if ( false === $deleted ) {
425
			return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) );
426
		}
427
428
		$taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
429