Code Duplication    Length = 7-7 lines in 3 locations

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

@@ 704-710 (lines=7) @@
701
702
			$meta = new WC_Order_Item_Meta( $item, $product );
703
			$item_meta = array();
704
			foreach ( $meta->get_formatted( null ) as $meta_key => $formatted_meta ) {
705
				$item_meta[] = array(
706
					'key' => $meta_key,
707
					'label' => $formatted_meta['label'],
708
					'value' => $formatted_meta['value'],
709
				);
710
			}
711
712
			$order_data['line_items'][] = array(
713
				'id'           => $item_id,

includes/api/class-wc-api-orders.php 2 locations

@@ 239-245 (lines=7) @@
236
237
			$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
238
239
			foreach ( $meta->get_formatted( $hideprefix ) as $meta_key => $formatted_meta ) {
240
				$item_meta[] = array(
241
					'key'   => $formatted_meta['key'],
242
					'label' => $formatted_meta['label'],
243
					'value' => $formatted_meta['value'],
244
				);
245
			}
246
247
			$line_item = array(
248
				'id'           => $item_id,
@@ 1567-1573 (lines=7) @@
1564
				$meta      = new WC_Order_Item_Meta( $item, $product );
1565
				$item_meta = array();
1566
1567
				foreach ( $meta->get_formatted() as $meta_key => $formatted_meta ) {
1568
					$item_meta[] = array(
1569
						'key' => $meta_key,
1570
						'label' => $formatted_meta['label'],
1571
						'value' => $formatted_meta['value'],
1572
					);
1573
				}
1574
1575
				$line_items[] = array(
1576
					'id'               => $item_id,