| @@ 87-95 (lines=9) @@ | ||
| 84 | * |
|
| 85 | * @param int|object|WC_Order $order Order to init. |
|
| 86 | */ |
|
| 87 | public function __construct( $order = 0 ) { |
|
| 88 | if ( is_numeric( $order ) && $order > 0 ) { |
|
| 89 | $this->read( $order ); |
|
| 90 | } elseif ( $order instanceof self ) { |
|
| 91 | $this->read( absint( $order->get_id() ) ); |
|
| 92 | } elseif ( ! empty( $order->ID ) ) { |
|
| 93 | $this->read( absint( $order->ID ) ); |
|
| 94 | } |
|
| 95 | } |
|
| 96 | ||
| 97 | /* |
|
| 98 | |-------------------------------------------------------------------------- |
|
| @@ 482-491 (lines=10) @@ | ||
| 479 | * @deprecated 2.7.0 Logic moved to constructor |
|
| 480 | * @param int|object|WC_Order $order Order to init. |
|
| 481 | */ |
|
| 482 | protected function init( $order ) { |
|
| 483 | _deprecated_function( 'init', '2.7', 'Logic moved to constructor' ); |
|
| 484 | if ( is_numeric( $order ) ) { |
|
| 485 | $this->read( $order ); |
|
| 486 | } elseif ( $order instanceof WC_Order ) { |
|
| 487 | $this->read( absint( $order->get_id() ) ); |
|
| 488 | } elseif ( isset( $order->ID ) ) { |
|
| 489 | $this->read( absint( $order->ID ) ); |
|
| 490 | } |
|
| 491 | } |
|
| 492 | ||
| 493 | /** |
|
| 494 | * Gets an order from the database. |
|