Code Duplication    Length = 20-20 lines in 2 locations

includes/abstracts/abstract-wc-legacy-order.php 2 locations

@@ 243-262 (lines=20) @@
240
	 * @param array $args
241
	 * @return int updated order item ID
242
	 */
243
	public function update_fee( $item, $args ) {
244
		_deprecated_function( 'WC_Order::update_fee', '2.7', 'Interact with WC_Order_Item_Fee class' );
245
		if ( is_numeric( $item ) ) {
246
			$item = $this->get_item( $item );
247
		}
248
		if ( ! is_object( $item ) || ! $item->is_type( 'fee' ) ) {
249
			return false;
250
		}
251
		if ( ! $this->get_id() ) {
252
			$this->save(); // Order must exist
253
		}
254
255
		$item->set_order_id( $this->get_id() );
256
		$item->set_all( $args );
257
		$item->save();
258
259
		do_action( 'woocommerce_order_update_fee', $this->get_id(), $item->get_id(), $args );
260
261
		return $item->get_id();
262
	}
263
264
	/**
265
	 * Update tax line on order.
@@ 273-292 (lines=20) @@
270
	 * @param array $args
271
	 * @return int updated order item ID
272
	 */
273
	public function update_tax( $item, $args ) {
274
		_deprecated_function( 'WC_Order::update_tax', '2.7', 'Interact with WC_Order_Item_Tax class' );
275
		if ( is_numeric( $item ) ) {
276
			$item = $this->get_item( $item );
277
		}
278
		if ( ! is_object( $item ) || ! $item->is_type( 'tax' ) ) {
279
			return false;
280
		}
281
		if ( ! $this->get_id() ) {
282
			$this->save(); // Order must exist
283
		}
284
285
		$item->set_order_id( $this->get_id() );
286
		$item->set_all( $args );
287
		$item->save();
288
289
		do_action( 'woocommerce_order_update_tax', $this->get_id(), $item->get_id(), $args );
290
291
		return $item->get_id();
292
	}
293
294
	/**
295
	 * Get a product (either product or variation).