Code Duplication    Length = 9-10 lines in 2 locations

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

@@ 751-759 (lines=9) @@
748
		}
749
750
		// Add fees.
751
		foreach ( $order->get_fees() as $fee_item_id => $fee_item ) {
752
			$order_data['fee_lines'][] = array(
753
				'id'        => $fee_item_id,
754
				'title'     => $fee_item['name'],
755
				'tax_class' => ( ! empty( $fee_item['tax_class'] ) ) ? $fee_item['tax_class'] : null,
756
				'total'     => wc_format_decimal( $order->get_line_total( $fee_item ), $dp ),
757
				'total_tax' => wc_format_decimal( $order->get_line_tax( $fee_item ), $dp ),
758
			);
759
		}
760
761
		// Add coupons.
762
		foreach ( $order->get_items( 'coupon' ) as $coupon_item_id => $coupon_item ) {

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

@@ 306-315 (lines=10) @@
303
		}
304
305
		// Add fees.
306
		foreach ( $order->get_fees() as $fee_item_id => $fee_item ) {
307
			$order_data['fee_lines'][] = array(
308
				'id'        => $fee_item_id,
309
				'title'     => $fee_item['name'],
310
				'tax_class' => ( ! empty( $fee_item['tax_class'] ) ) ? $fee_item['tax_class'] : null,
311
				'total'     => wc_format_decimal( $order->get_line_total( $fee_item ), $dp ),
312
				'total_tax' => wc_format_decimal( $order->get_line_tax( $fee_item ), $dp ),
313
			);
314
		}
315
316
		// Add coupons.
317
		foreach ( $order->get_items( 'coupon' ) as $coupon_item_id => $coupon_item ) {
318
			$coupon_line = array(