Code Duplication    Length = 43-43 lines in 3 locations

includes/api/legacy/v1/class-wc-api-customers.php 1 location

@@ 360-402 (lines=43) @@
357
	 * @param $order
358
	 * @return array
359
	 */
360
	public function add_customer_data( $order_data, $order ) {
361
362
		if ( 0 == $order->customer_user ) {
363
364
			// add customer data from order
365
			$order_data['customer'] = array(
366
				'id'               => 0,
367
				'email'            => $order->billing_email,
368
				'first_name'       => $order->billing_first_name,
369
				'last_name'        => $order->billing_last_name,
370
				'billing_address'  => array(
371
					'first_name' => $order->billing_first_name,
372
					'last_name'  => $order->billing_last_name,
373
					'company'    => $order->billing_company,
374
					'address_1'  => $order->billing_address_1,
375
					'address_2'  => $order->billing_address_2,
376
					'city'       => $order->billing_city,
377
					'state'      => $order->billing_state,
378
					'postcode'   => $order->billing_postcode,
379
					'country'    => $order->billing_country,
380
					'email'      => $order->billing_email,
381
					'phone'      => $order->billing_phone,
382
				),
383
				'shipping_address' => array(
384
					'first_name' => $order->shipping_first_name,
385
					'last_name'  => $order->shipping_last_name,
386
					'company'    => $order->shipping_company,
387
					'address_1'  => $order->shipping_address_1,
388
					'address_2'  => $order->shipping_address_2,
389
					'city'       => $order->shipping_city,
390
					'state'      => $order->shipping_state,
391
					'postcode'   => $order->shipping_postcode,
392
					'country'    => $order->shipping_country,
393
				),
394
			);
395
396
		} else {
397
398
			$order_data['customer'] = current( $this->get_customer( $order->customer_user ) );
399
		}
400
401
		return $order_data;
402
	}
403
404
	/**
405
	 * Modify the WP_User_Query to support filtering on the date the customer was created

includes/api/legacy/v2/class-wc-api-customers.php 1 location

@@ 621-663 (lines=43) @@
618
	 * @param $order
619
	 * @return array
620
	 */
621
	public function add_customer_data( $order_data, $order ) {
622
623
		if ( 0 == $order->customer_user ) {
624
625
			// add customer data from order
626
			$order_data['customer'] = array(
627
				'id'               => 0,
628
				'email'            => $order->billing_email,
629
				'first_name'       => $order->billing_first_name,
630
				'last_name'        => $order->billing_last_name,
631
				'billing_address'  => array(
632
					'first_name' => $order->billing_first_name,
633
					'last_name'  => $order->billing_last_name,
634
					'company'    => $order->billing_company,
635
					'address_1'  => $order->billing_address_1,
636
					'address_2'  => $order->billing_address_2,
637
					'city'       => $order->billing_city,
638
					'state'      => $order->billing_state,
639
					'postcode'   => $order->billing_postcode,
640
					'country'    => $order->billing_country,
641
					'email'      => $order->billing_email,
642
					'phone'      => $order->billing_phone,
643
				),
644
				'shipping_address' => array(
645
					'first_name' => $order->shipping_first_name,
646
					'last_name'  => $order->shipping_last_name,
647
					'company'    => $order->shipping_company,
648
					'address_1'  => $order->shipping_address_1,
649
					'address_2'  => $order->shipping_address_2,
650
					'city'       => $order->shipping_city,
651
					'state'      => $order->shipping_state,
652
					'postcode'   => $order->shipping_postcode,
653
					'country'    => $order->shipping_country,
654
				),
655
			);
656
657
		} else {
658
659
			$order_data['customer'] = current( $this->get_customer( $order->customer_user ) );
660
		}
661
662
		return $order_data;
663
	}
664
665
	/**
666
	 * Modify the WP_User_Query to support filtering on the date the customer was created

includes/api/legacy/v3/class-wc-api-customers.php 1 location

@@ 610-652 (lines=43) @@
607
	 * @param $order
608
	 * @return array
609
	 */
610
	public function add_customer_data( $order_data, $order ) {
611
612
		if ( 0 == $order->customer_user ) {
613
614
			// add customer data from order
615
			$order_data['customer'] = array(
616
				'id'               => 0,
617
				'email'            => $order->billing_email,
618
				'first_name'       => $order->billing_first_name,
619
				'last_name'        => $order->billing_last_name,
620
				'billing_address'  => array(
621
					'first_name' => $order->billing_first_name,
622
					'last_name'  => $order->billing_last_name,
623
					'company'    => $order->billing_company,
624
					'address_1'  => $order->billing_address_1,
625
					'address_2'  => $order->billing_address_2,
626
					'city'       => $order->billing_city,
627
					'state'      => $order->billing_state,
628
					'postcode'   => $order->billing_postcode,
629
					'country'    => $order->billing_country,
630
					'email'      => $order->billing_email,
631
					'phone'      => $order->billing_phone,
632
				),
633
				'shipping_address' => array(
634
					'first_name' => $order->shipping_first_name,
635
					'last_name'  => $order->shipping_last_name,
636
					'company'    => $order->shipping_company,
637
					'address_1'  => $order->shipping_address_1,
638
					'address_2'  => $order->shipping_address_2,
639
					'city'       => $order->shipping_city,
640
					'state'      => $order->shipping_state,
641
					'postcode'   => $order->shipping_postcode,
642
					'country'    => $order->shipping_country,
643
				),
644
			);
645
646
		} else {
647
648
			$order_data['customer'] = current( $this->get_customer( $order->customer_user ) );
649
		}
650
651
		return $order_data;
652
	}
653
654
	/**
655
	 * Modify the WP_User_Query to support filtering on the date the customer was created