| @@ 43-51 (lines=9) @@ | ||
| 40 | * Get the refund if ID is passed, otherwise the refund is new and empty. |
|
| 41 | * @param int|object|WC_Order_Refund $refund Refund to init. |
|
| 42 | */ |
|
| 43 | public function __construct( $refund = 0 ) { |
|
| 44 | if ( is_numeric( $refund ) ) { |
|
| 45 | $this->read( $refund ); |
|
| 46 | } elseif ( $order instanceof WC_Order_Refund ) { |
|
| 47 | $this->read( absint( $refund->get_id() ) ); |
|
| 48 | } elseif ( ! empty( $refund->ID ) ) { |
|
| 49 | $this->read( absint( $refund->ID ) ); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Get refunded amount. |
|
| @@ 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. |
|
| @@ 2970-2979 (lines=10) @@ | ||
| 2967 | * @deprecated 2.6.0 Logic moved to constructor |
|
| 2968 | * @param int|object|WC_Order $order Order to init. |
|
| 2969 | */ |
|
| 2970 | protected function init( $order ) { |
|
| 2971 | _deprecated_function( 'init', '2.6', 'Logic moved to constructor' ); |
|
| 2972 | if ( is_numeric( $order ) ) { |
|
| 2973 | $this->read( $order ); |
|
| 2974 | } elseif ( $order instanceof WC_Order ) { |
|
| 2975 | $this->read( absint( $order->get_id() ) ); |
|
| 2976 | } elseif ( isset( $order->ID ) ) { |
|
| 2977 | $this->read( absint( $order->ID ) ); |
|
| 2978 | } |
|
| 2979 | } |
|
| 2980 | ||
| 2981 | /** |
|
| 2982 | * Gets an order from the database. |
|