Code Duplication    Length = 7-9 lines in 2 locations

includes/cli/class-wc-cli-order.php 1 location

@@ 854-862 (lines=9) @@
851
	 * @param int $order_id valid order ID
852
	 * @param array $order_meta order meta in array( 'meta_key' => 'meta_value' ) format
853
	 */
854
	protected function set_order_meta( $order_id, $order_meta ) {
855
856
		foreach ( $order_meta as $meta_key => $meta_value ) {
857
858
			if ( is_string( $meta_key) && ! is_protected_meta( $meta_key ) && is_scalar( $meta_value ) ) {
859
				update_post_meta( $order_id, $meta_key, $meta_value );
860
			}
861
		}
862
	}
863
864
	/**
865
	 * Wrapper method to create/update order items

includes/api/class-wc-rest-orders-controller.php 1 location

@@ 865-871 (lines=7) @@
862
	 * @param int $order_id Order ID.
863
	 * @param array $meta_data Meta data in array( 'meta_key' => 'meta_value' ) format.
864
	 */
865
	protected function update_meta_data( $order_id, $meta_data ) {
866
		foreach ( $meta_data as $meta_key => $meta_value ) {
867
			if ( is_string( $meta_key ) && ! is_protected_meta( $meta_key ) && is_scalar( $meta_value ) ) {
868
				update_post_meta( $order_id, $meta_key, $meta_value );
869
			}
870
		}
871
	}
872
873
	/**
874
	 * Create a single item.