includes/abstracts/abstract-wc-item.php 1 location
|
@@ 23-35 (lines=13) @@
|
| 20 |
|
* Constructor. |
| 21 |
|
* @param int|object|array $read ID to load from the DB (optional) or already queried data. |
| 22 |
|
*/ |
| 23 |
|
public function __construct( $read = 0 ) { |
| 24 |
|
parent::__construct( $read ); |
| 25 |
|
|
| 26 |
|
if ( $read instanceof WC_Item ) { |
| 27 |
|
if ( $this->is_type( $read->get_type() ) ) { |
| 28 |
|
$this->set_props( $read->get_data() ); |
| 29 |
|
} |
| 30 |
|
} elseif ( is_array( $read ) ) { |
| 31 |
|
$this->set_props( $read ); |
| 32 |
|
} else { |
| 33 |
|
$this->read( $read ); |
| 34 |
|
} |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
/** |
| 38 |
|
* Type checking |
includes/class-wc-order-item.php 1 location
|
@@ 54-66 (lines=13) @@
|
| 51 |
|
* Constructor. |
| 52 |
|
* @param int|object|array $read ID to load from the DB (optional) or already queried data. |
| 53 |
|
*/ |
| 54 |
|
public function __construct( $read = 0 ) { |
| 55 |
|
parent::__construct( $read ); |
| 56 |
|
|
| 57 |
|
if ( $read instanceof WC_Order_Item ) { |
| 58 |
|
if ( $this->is_type( $read->get_type() ) ) { |
| 59 |
|
$this->set_props( $read->get_data() ); |
| 60 |
|
} |
| 61 |
|
} elseif ( is_array( $read ) ) { |
| 62 |
|
$this->set_props( $read ); |
| 63 |
|
} else { |
| 64 |
|
$this->read( $read ); |
| 65 |
|
} |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
/** |
| 69 |
|
* Type checking |