Code Duplication    Length = 20-20 lines in 2 locations

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

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