| @@ 509-518 (lines=10) @@ | ||
| 506 | * @deprecated 2.6.0 Logic moved to constructor |
|
| 507 | * @param int|object|WC_Order $order Order to init. |
|
| 508 | */ |
|
| 509 | protected function init( $order ) { |
|
| 510 | _deprecated_function( 'init', '2.6', 'Logic moved to constructor' ); |
|
| 511 | if ( is_numeric( $order ) ) { |
|
| 512 | $this->read( $order ); |
|
| 513 | } elseif ( $order instanceof WC_Order ) { |
|
| 514 | $this->read( absint( $order->get_id() ) ); |
|
| 515 | } elseif ( isset( $order->ID ) ) { |
|
| 516 | $this->read( absint( $order->ID ) ); |
|
| 517 | } |
|
| 518 | } |
|
| 519 | ||
| 520 | /** |
|
| 521 | * Gets an order from the database. |
|
| @@ 69-77 (lines=9) @@ | ||
| 66 | * |
|
| 67 | * @param int|object|WC_Order $order Order to init. |
|
| 68 | */ |
|
| 69 | public function __construct( $order = 0 ) { |
|
| 70 | if ( is_numeric( $order ) && $order > 0 ) { |
|
| 71 | $this->read( $order ); |
|
| 72 | } elseif ( $order instanceof self ) { |
|
| 73 | $this->read( absint( $order->get_id() ) ); |
|
| 74 | } elseif ( ! empty( $order->ID ) ) { |
|
| 75 | $this->read( absint( $order->ID ) ); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Change data to JSON format. |
|