|
@@ 104-112 (lines=9) @@
|
| 101 |
|
* |
| 102 |
|
* @param int|object|WC_Order $order Order to init. |
| 103 |
|
*/ |
| 104 |
|
public function __construct( $order = 0 ) { |
| 105 |
|
if ( is_numeric( $order ) ) { |
| 106 |
|
$this->read( $order ); |
| 107 |
|
} elseif ( $order instanceof WC_Order ) { |
| 108 |
|
$this->read( absint( $order->get_order_id() ) ); |
| 109 |
|
} elseif ( ! empty( $order->ID ) ) { |
| 110 |
|
$this->read( absint( $order->ID ) ); |
| 111 |
|
} |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
/** |
| 115 |
|
* Change data to JSON format. |
|
@@ 2951-2960 (lines=10) @@
|
| 2948 |
|
* @deprecated 2.6.0 Logic moved to constructor |
| 2949 |
|
* @param int|object|WC_Order $order Order to init. |
| 2950 |
|
*/ |
| 2951 |
|
protected function init( $order ) { |
| 2952 |
|
_deprecated_function( 'init', '2.6', 'Logic moved to constructor' ); |
| 2953 |
|
if ( is_numeric( $order ) ) { |
| 2954 |
|
$this->read( $order ); |
| 2955 |
|
} elseif ( $order instanceof WC_Order ) { |
| 2956 |
|
$this->read( absint( $order->get_order_id() ) ); |
| 2957 |
|
} elseif ( isset( $order->ID ) ) { |
| 2958 |
|
$this->read( absint( $order->ID ) ); |
| 2959 |
|
} |
| 2960 |
|
} |
| 2961 |
|
|
| 2962 |
|
/** |
| 2963 |
|
* Gets an order from the database. |