| @@ 516-525 (lines=10) @@ | ||
| 513 | * @deprecated 2.7.0 Logic moved to constructor |
|
| 514 | * @param int|object|WC_Order $order Order to init. |
|
| 515 | */ |
|
| 516 | protected function init( $order ) { |
|
| 517 | _deprecated_function( 'init', '2.7', 'Logic moved to constructor' ); |
|
| 518 | if ( is_numeric( $order ) ) { |
|
| 519 | $this->read( $order ); |
|
| 520 | } elseif ( $order instanceof WC_Order ) { |
|
| 521 | $this->read( absint( $order->get_id() ) ); |
|
| 522 | } elseif ( isset( $order->ID ) ) { |
|
| 523 | $this->read( absint( $order->ID ) ); |
|
| 524 | } |
|
| 525 | } |
|
| 526 | ||
| 527 | /** |
|
| 528 | * Gets an order from the database. |
|
| @@ 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 | |-------------------------------------------------------------------------- |
|