Code Duplication    Length = 9-10 lines in 3 locations

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

@@ 105-113 (lines=9) @@
102
     *
103
     * @param  int|object|WC_Order $order Order to init.
104
     */
105
    public function __construct( $order = 0 ) {
106
		if ( is_numeric( $order ) ) {
107
            $this->read( $order );
108
        } elseif ( $order instanceof WC_Order ) {
109
            $this->read( absint( $order->get_id() ) );
110
        } elseif ( ! empty( $order->ID ) ) {
111
            $this->read( absint( $order->ID ) );
112
        }
113
    }
114
115
    /**
116
     * Change data to JSON format.
@@ 2977-2986 (lines=10) @@
2974
     * @deprecated 2.6.0 Logic moved to constructor
2975
     * @param int|object|WC_Order $order Order to init.
2976
     */
2977
    protected function init( $order ) {
2978
		_deprecated_function( 'init', '2.6', 'Logic moved to constructor' );
2979
        if ( is_numeric( $order ) ) {
2980
            $this->read( $order );
2981
        } elseif ( $order instanceof WC_Order ) {
2982
            $this->read( absint( $order->get_id() ) );
2983
        } elseif ( isset( $order->ID ) ) {
2984
            $this->read( absint( $order->ID ) );
2985
        }
2986
    }
2987
2988
    /**
2989
     * Gets an order from the database.

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

@@ 32-41 (lines=10) @@
29
     * Get the refund if ID is passed, otherwise the refund is new and empty.
30
     * @param  int|object|WC_Order_Refund $refund Refund to init.
31
     */
32
    public function __construct( $refund = 0 ) {
33
		if ( is_numeric( $refund ) ) {
34
            $this->read( $refund );
35
        } elseif ( $order instanceof WC_Order_Refund ) {
36
            $this->read( $refund->get_id() );
37
        } elseif ( ! empty( $refund->ID ) ) {
38
            $this->read( absint( $refund->ID ) );
39
        }
40
		$this->set_order_type( 'refund' );
41
    }
42
43
	/**
44
	 * Get refunded amount.