Code Duplication    Length = 20-20 lines in 2 locations

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

@@ 151-170 (lines=20) @@
148
	 * @param array $args
149
	 * @return int updated order item ID
150
	 */
151
	public function update_fee( $item, $args ) {
152
		_deprecated_function( 'WC_Order::update_fee', '2.7', 'Interact with WC_Order_Item_Fee class' );
153
		if ( is_numeric( $item ) ) {
154
			$item = $this->get_item( $item );
155
		}
156
		if ( ! is_object( $item ) || ! $item->is_type( 'fee' ) ) {
157
			return false;
158
		}
159
		if ( ! $this->get_id() ) {
160
			$this->save(); // Order must exist
161
		}
162
163
		$item->set_order_id( $this->get_id() );
164
		$item->set_all( $args );
165
		$item->save();
166
167
		do_action( 'woocommerce_order_update_fee', $this->get_id(), $item->get_id(), $args );
168
169
		return $item->get_id();
170
	}
171
172
	/**
173
	 * Update tax line on order.
@@ 181-200 (lines=20) @@
178
	 * @param array $args
179
	 * @return int updated order item ID
180
	 */
181
	public function update_tax( $item, $args ) {
182
		_deprecated_function( 'WC_Order::update_tax', '2.7', 'Interact with WC_Order_Item_Tax class' );
183
		if ( is_numeric( $item ) ) {
184
			$item = $this->get_item( $item );
185
		}
186
		if ( ! is_object( $item ) || ! $item->is_type( 'tax' ) ) {
187
			return false;
188
		}
189
		if ( ! $this->get_id() ) {
190
			$this->save(); // Order must exist
191
		}
192
193
		$item->set_order_id( $this->get_id() );
194
		$item->set_all( $args );
195
		$item->save();
196
197
		do_action( 'woocommerce_order_update_tax', $this->get_id(), $item->get_id(), $args );
198
199
		return $item->get_id();
200
	}
201
202
	/**
203
	 * Get a product (either product or variation).