diff --git a/includes/abstracts/abstract-wc-data.php b/includes/abstracts/abstract-wc-data.php index 22f362553c2..30c88e98364 100644 --- a/includes/abstracts/abstract-wc-data.php +++ b/includes/abstracts/abstract-wc-data.php @@ -380,25 +380,6 @@ abstract class WC_Data { $this->_data = $this->_default_data; } - /** - * Get internal data prop (raw). - * @param string ...$param Prop keys to retrieve. Supports multiple keys to get nested values. - * @return mixed - */ - protected function get_prop() { - $args = func_get_args(); - $prop = &$this->_data; - - foreach ( $args as $arg ) { - if ( ! isset( $prop[ $arg ] ) ) { - return false; - } - $prop = &$prop[ $arg ]; - } - - return $prop; - } - /** * Set a collection of props in one go, collect any errors, and return the result. * @param array $props Key value pairs to set. Key is the prop and should map to a setter function name. @@ -421,27 +402,6 @@ abstract class WC_Data { return sizeof( $errors->get_error_codes() ) ? $errors : true; } - /** - * Set internal data prop to specified value. - * @param int ...$param Prop keys followed by value to set. - * @throws WC_Data_Exception - */ - protected function set_prop() { - if ( func_num_args() < 2 ) { - $this->error( 'invalid_value', __( 'set_prop() requires at least 2 parameters', 'woocommerce' ) ); - } - - $args = func_get_args(); - $value = array_pop( $args ); - $prop = &$this->_data; - - foreach ( $args as $arg ) { - $prop = &$prop[ $arg ]; - } - - $prop = $value; - } - /** * When invalid data is found, throw an exception unless reading from the DB. * @param string $error_code Error code. diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php index 91efbf7e305..207cc99ac82 100644 --- a/includes/abstracts/abstract-wc-order.php +++ b/includes/abstracts/abstract-wc-order.php @@ -370,7 +370,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return integer */ public function get_id() { - return $this->get_prop( 'id' ); + return $this->_data['id']; } /** @@ -379,7 +379,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return integer */ public function get_parent_id() { - return $this->get_prop( 'parent_id' ); + return $this->_data['parent_id']; } /** @@ -387,7 +387,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return string */ public function get_currency() { - return apply_filters( 'woocommerce_get_currency', $this->get_prop( 'currency' ), $this ); + return apply_filters( 'woocommerce_get_currency', $this->_data['currency'], $this ); } /** @@ -395,7 +395,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return string */ public function get_version() { - return $this->get_prop( 'version' ); + return $this->_data['version']; } /** @@ -403,7 +403,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return bool */ public function get_prices_include_tax() { - return $this->get_prop( 'prices_include_tax' ); + return $this->_data['prices_include_tax']; } /** @@ -411,7 +411,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return int */ public function get_date_created() { - return $this->get_prop( 'date_created' ); + return $this->_data['date_created']; } /** @@ -419,7 +419,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return int */ public function get_date_modified() { - return $this->get_prop( 'date_modified' ); + return $this->_data['date_modified']; } /** @@ -427,7 +427,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return string */ public function get_status() { - $status = $this->get_prop( 'status' ); + $status = $this->_data['status']; return apply_filters( 'woocommerce_order_get_status', 'wc-' === substr( $status, 0, 3 ) ? substr( $status, 3 ) : $status, $this ); } @@ -437,7 +437,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return string */ public function get_discount_total( $raw = false ) { - $value = wc_format_decimal( $this->get_prop( 'discount_total' ) ); + $value = wc_format_decimal( $this->_data['discount_total'] ); return $raw ? $value : apply_filters( 'woocommerce_order_amount_discount_total', $value, $this ); } @@ -447,7 +447,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return string */ public function get_discount_tax( $raw = false ) { - $value = wc_format_decimal( $this->get_prop( 'discount_tax' ) ); + $value = wc_format_decimal( $this->_data['discount_tax'] ); return $raw ? $value : apply_filters( 'woocommerce_order_amount_discount_tax', $value, $this ); } @@ -457,7 +457,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return string */ public function get_shipping_total( $raw = false ) { - $value = wc_format_decimal( $this->get_prop( 'shipping_total' ) ); + $value = wc_format_decimal( $this->_data['shipping_total'] ); return $raw ? $value : apply_filters( 'woocommerce_order_amount_shipping_total', $value, $this ); } @@ -467,7 +467,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return string */ public function get_shipping_tax( $raw = false ) { - $value = wc_format_decimal( $this->get_prop( 'shipping_tax' ) ); + $value = wc_format_decimal( $this->_data['shipping_tax'] ); return $raw ? $value : apply_filters( 'woocommerce_order_amount_shipping_tax', $value, $this ); } @@ -477,7 +477,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return float */ public function get_cart_tax( $raw = false ) { - $value = wc_format_decimal( $this->get_prop( 'cart_tax' ) ); + $value = wc_format_decimal( $this->_data['cart_tax'] ); return $raw ? $value : apply_filters( 'woocommerce_order_amount_cart_tax', $value, $this ); } @@ -487,7 +487,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return float */ public function get_total( $raw = false ) { - $value = wc_format_decimal( $this->get_prop( 'total' ), wc_get_price_decimals() ); + $value = wc_format_decimal( $this->_data['total'], wc_get_price_decimals() ); return $raw ? $value : apply_filters( 'woocommerce_order_amount_total', $value, $this ); } @@ -502,7 +502,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @return float */ public function get_total_tax( $raw = false ) { - $value = wc_format_decimal( $this->get_prop( 'total_tax' ) ); + $value = wc_format_decimal( $this->_data['total_tax'] ); return $raw ? $value : apply_filters( 'woocommerce_order_amount_total_tax', $value, $this ); } @@ -585,7 +585,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_id( $value ) { - $this->set_prop( 'id', absint( $value ) ); + $this->_data['id'] = absint( $value ); } /** @@ -598,7 +598,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { if ( $value && ! get_post( $value ) ) { $this->error( 'order_invalid_parent_id', __( 'Invalid parent ID', 'woocommerce' ) ); } - $this->set_prop( 'parent_id', absint( $value ) ); + $this->_data['parent_id'] = absint( $value ); } /** @@ -616,7 +616,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { $new_status = 'pending'; } - $this->set_prop( 'status', 'wc-' . $new_status ); + $this->_data['status'] = 'wc-' . $new_status; // If the old status is set but unknown (e.g. draft) assume its pending for action usage. if ( $old_status && ! in_array( 'wc-' . $old_status, array_keys( wc_get_order_statuses() ) ) ) { @@ -635,7 +635,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_version( $value ) { - $this->set_prop( 'version', $value ); + $this->_data['version'] = $value; } /** @@ -647,7 +647,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { if ( $value && ! in_array( $value, array_keys( get_woocommerce_currencies() ) ) ) { $this->error( 'order_invalid_currency', __( 'Invalid currency code', 'woocommerce' ) ); } - $this->set_prop( 'currency', $value ); + $this->_data['currency'] = $value; } /** @@ -656,7 +656,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_prices_include_tax( $value ) { - $this->set_prop( 'prices_include_tax', (bool) $value ); + $this->_data['prices_include_tax'] = (bool) $value; } /** @@ -665,7 +665,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_date_created( $timestamp ) { - $this->set_prop( 'date_created', is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ) ); + $this->_data['date_created'] = is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ); } /** @@ -674,7 +674,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_date_modified( $timestamp ) { - $this->set_prop( 'date_modified', is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ) ); + $this->_data['date_modified'] = is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ); } /** @@ -683,7 +683,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_discount_total( $value ) { - $this->set_prop( 'discount_total', wc_format_decimal( $value ) ); + $this->_data['discount_total'] = wc_format_decimal( $value ); } /** @@ -692,7 +692,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_discount_tax( $value ) { - $this->set_prop( 'discount_tax', wc_format_decimal( $value ) ); + $this->_data['discount_tax'] = wc_format_decimal( $value ); } /** @@ -701,7 +701,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_shipping_total( $value ) { - $this->set_prop( 'shipping_total', wc_format_decimal( $value ) ); + $this->_data['shipping_total'] = wc_format_decimal( $value ); } /** @@ -710,7 +710,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_shipping_tax( $value ) { - $this->set_prop( 'shipping_tax', wc_format_decimal( $value ) ); + $this->_data['shipping_tax'] = wc_format_decimal( $value ); $this->set_total_tax( $this->get_cart_tax() + $this->get_shipping_tax() ); } @@ -720,7 +720,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ public function set_cart_tax( $value ) { - $this->set_prop( 'cart_tax', wc_format_decimal( $value ) ); + $this->_data['cart_tax'] = wc_format_decimal( $value ); $this->set_total_tax( $this->get_cart_tax() + $this->get_shipping_tax() ); } @@ -730,7 +730,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * @throws WC_Data_Exception */ protected function set_total_tax( $value ) { - $this->set_prop( 'total_tax', wc_format_decimal( $value ) ); + $this->_data['total_tax'] = wc_format_decimal( $value ); } /** @@ -744,7 +744,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { _deprecated_argument( 'total_type', '2.7', 'Use dedicated total setter methods instead.' ); return $this->legacy_set_total( $value, $deprecated ); } - $this->set_prop( 'total', wc_format_decimal( $value, wc_get_price_decimals() ) ); + $this->_data['total'] = wc_format_decimal( $value, wc_get_price_decimals() ); } /* diff --git a/includes/class-wc-order-item-coupon.php b/includes/class-wc-order-item-coupon.php index 9875935cb9a..204404f9ab8 100644 --- a/includes/class-wc-order-item-coupon.php +++ b/includes/class-wc-order-item-coupon.php @@ -127,7 +127,7 @@ class WC_Order_Item_Coupon extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_code( $value ) { - $this->set_prop( 'code', wc_clean( $value ) ); + $this->_data['code'] = wc_clean( $value ); } /** @@ -136,7 +136,7 @@ class WC_Order_Item_Coupon extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_discount( $value ) { - $this->set_prop( 'discount', wc_format_decimal( $value ) ); + $this->_data['discount'] = wc_format_decimal( $value ); } /** @@ -145,7 +145,7 @@ class WC_Order_Item_Coupon extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_discount_tax( $value ) { - $this->set_prop( 'discount_tax', wc_format_decimal( $value ) ); + $this->_data['discount_tax'] = wc_format_decimal( $value ); } /* @@ -175,7 +175,7 @@ class WC_Order_Item_Coupon extends WC_Order_Item { * @return string */ public function get_code() { - return $this->get_prop( 'code' ); + return $this->_data['code']; } /** @@ -183,7 +183,7 @@ class WC_Order_Item_Coupon extends WC_Order_Item { * @return string */ public function get_discount() { - return wc_format_decimal( $this->get_prop( 'discount' ) ); + return wc_format_decimal( $this->_data['discount'] ); } /** @@ -191,6 +191,6 @@ class WC_Order_Item_Coupon extends WC_Order_Item { * @return string */ public function get_discount_tax() { - return wc_format_decimal( $this->get_prop( 'discount_tax' ) ); + return wc_format_decimal( $this->_data['discount_tax'] ); } } diff --git a/includes/class-wc-order-item-fee.php b/includes/class-wc-order-item-fee.php index 0a5e6394fc3..b071bf7067c 100644 --- a/includes/class-wc-order-item-fee.php +++ b/includes/class-wc-order-item-fee.php @@ -135,7 +135,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { if ( $value && ! in_array( $value, WC_Tax::get_tax_classes() ) ) { $this->error( 'order_item_fee_invalid_tax_class', __( 'Invalid tax class', 'woocommerce' ) ); } - $this->set_prop( 'tax_class', $value ); + $this->_data['tax_class'] = $value; } /** @@ -145,9 +145,9 @@ class WC_Order_Item_Fee extends WC_Order_Item { */ public function set_tax_status( $value ) { if ( in_array( $value, array( 'taxable', 'none' ) ) ) { - $this->set_prop( 'tax_status', $value ); + $this->_data['tax_status'] = $value; } else { - $this->set_prop( 'tax_status', 'taxable' ); + $this->_data['tax_status'] = 'taxable'; } } @@ -157,7 +157,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_total( $value ) { - $this->set_prop( 'total', wc_format_decimal( $value ) ); + $this->_data['total'] = wc_format_decimal( $value ); } /** @@ -166,7 +166,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @throws WC_Data_Exception */ protected function set_total_tax( $value ) { - $this->set_prop( 'total_tax', wc_format_decimal( $value ) ); + $this->_data['total_tax'] = wc_format_decimal( $value ); } /** @@ -184,7 +184,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { if ( ! empty( $raw_tax_data['total'] ) ) { $tax_data['total'] = array_map( 'wc_format_decimal', $raw_tax_data['total'] ); } - $this->set_prop( 'taxes', $tax_data ); + $this->_data['taxes'] = $tax_data; $this->set_total_tax( array_sum( $tax_data['total'] ) ); } @@ -199,7 +199,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @return string */ public function get_name() { - return $this->get_prop( 'name' ) ? $this->get_prop( 'name' ) : __( 'Fee', 'woocommerce' ); + return $this->_data['name'] ? $this->_data['name'] : __( 'Fee', 'woocommerce' ); } /** @@ -215,7 +215,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @return string */ public function get_tax_class() { - return $this->get_prop( 'tax_class' ); + return $this->_data['tax_class']; } /** @@ -223,7 +223,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @return string */ public function get_tax_status() { - return $this->get_prop( 'tax_status' ); + return $this->_data['tax_status']; } /** @@ -231,7 +231,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @return string */ public function get_total() { - return wc_format_decimal( $this->get_prop( 'total' ) ); + return wc_format_decimal( $this->_data['total'] ); } /** @@ -239,7 +239,7 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @return string */ public function get_total_tax() { - return wc_format_decimal( $this->get_prop( 'total_tax' ) ); + return wc_format_decimal( $this->_data['total_tax'] ); } /** @@ -247,6 +247,6 @@ class WC_Order_Item_Fee extends WC_Order_Item { * @return array */ public function get_taxes() { - return $this->get_prop( 'taxes' ); + return $this->_data['taxes']; } } diff --git a/includes/class-wc-order-item-product.php b/includes/class-wc-order-item-product.php index 23c1f0d7b07..5f77e463906 100644 --- a/includes/class-wc-order-item-product.php +++ b/includes/class-wc-order-item-product.php @@ -240,7 +240,7 @@ class WC_Order_Item_Product extends WC_Order_Item { if ( 0 >= $value ) { $this->error( 'order_item_product_invalid_quantity', __( 'Quantity must be positive', 'woocommerce' ) ); } - $this->set_prop( 'quantity', wc_stock_amount( $value ) ); + $this->_data['quantity'] = wc_stock_amount( $value ); } /** @@ -252,7 +252,7 @@ class WC_Order_Item_Product extends WC_Order_Item { if ( $value && ! in_array( $value, WC_Tax::get_tax_classes() ) ) { $this->error( 'order_item_product_invalid_tax_class', __( 'Invalid tax class', 'woocommerce' ) ); } - $this->set_prop( 'tax_class', $value ); + $this->_data['tax_class'] = $value; } /** @@ -264,7 +264,7 @@ class WC_Order_Item_Product extends WC_Order_Item { if ( $value > 0 && 'product' !== get_post_type( absint( $value ) ) ) { $this->error( 'order_item_product_invalid_product_id', __( 'Invalid product ID', 'woocommerce' ) ); } - $this->set_prop( 'product_id', absint( $value ) ); + $this->_data['product_id'] = absint( $value ); } /** @@ -276,7 +276,7 @@ class WC_Order_Item_Product extends WC_Order_Item { if ( $value > 0 && 'product_variation' !== get_post_type( $value ) ) { $this->error( 'order_item_product_invalid_variation_id', __( 'Invalid variation ID', 'woocommerce' ) ); } - $this->set_prop( 'variation_id', absint( $value ) ); + $this->_data['variation_id'] = absint( $value ); } /** @@ -285,7 +285,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_subtotal( $value ) { - $this->set_prop( 'subtotal', wc_format_decimal( $value ) ); + $this->_data['subtotal'] = wc_format_decimal( $value ); } /** @@ -294,7 +294,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_total( $value ) { - $this->set_prop( 'total', wc_format_decimal( $value ) ); + $this->_data['total'] = wc_format_decimal( $value ); // Subtotal cannot be less than total if ( ! $this->get_subtotal() || $this->get_subtotal() < $this->get_total() ) { @@ -308,7 +308,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @throws WC_Data_Exception */ protected function set_subtotal_tax( $value ) { - $this->set_prop( 'subtotal_tax', wc_format_decimal( $value ) ); + $this->_data['subtotal_tax'] = wc_format_decimal( $value ); } /** @@ -317,7 +317,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @throws WC_Data_Exception */ protected function set_total_tax( $value ) { - $this->set_prop( 'total_tax', wc_format_decimal( $value ) ); + $this->_data['total_tax'] = wc_format_decimal( $value ); } /** @@ -340,7 +340,7 @@ class WC_Order_Item_Product extends WC_Order_Item { $tax_data['subtotal'] = $tax_data['total']; } } - $this->set_prop( 'taxes', $tax_data ); + $this->_data['taxes'] = $tax_data; $this->set_total_tax( array_sum( $tax_data['total'] ) ); $this->set_subtotal_tax( array_sum( $tax_data['subtotal'] ) ); } @@ -390,7 +390,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return int */ public function get_product_id() { - return absint( $this->get_prop( 'product_id' ) ); + return absint( $this->_data['product_id'] ); } /** @@ -398,7 +398,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return int */ public function get_variation_id() { - return absint( $this->get_prop( 'variation_id' ) ); + return absint( $this->_data['variation_id'] ); } /** @@ -406,7 +406,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return int */ public function get_quantity() { - return wc_stock_amount( $this->get_prop( 'quantity' ) ); + return wc_stock_amount( $this->_data['quantity'] ); } /** @@ -414,7 +414,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return string */ public function get_tax_class() { - return $this->get_prop( 'tax_class' ); + return $this->_data['tax_class']; } /** @@ -422,7 +422,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return string */ public function get_subtotal() { - return wc_format_decimal( $this->get_prop( 'subtotal' ) ); + return wc_format_decimal( $this->_data['subtotal'] ); } /** @@ -430,7 +430,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return string */ public function get_subtotal_tax() { - return wc_format_decimal( $this->get_prop( 'subtotal_tax' ) ); + return wc_format_decimal( $this->_data['subtotal_tax'] ); } /** @@ -438,7 +438,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return string */ public function get_total() { - return wc_format_decimal( $this->get_prop( 'total' ) ); + return wc_format_decimal( $this->_data['total'] ); } /** @@ -446,7 +446,7 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return string */ public function get_total_tax() { - return wc_format_decimal( $this->get_prop( 'total_tax' ) ); + return wc_format_decimal( $this->_data['total_tax'] ); } /** @@ -454,6 +454,6 @@ class WC_Order_Item_Product extends WC_Order_Item { * @return array */ public function get_taxes() { - return $this->get_prop( 'taxes' ); + return $this->_data['taxes']; } } diff --git a/includes/class-wc-order-item-shipping.php b/includes/class-wc-order-item-shipping.php index f779cd4803a..6e09ffc325b 100644 --- a/includes/class-wc-order-item-shipping.php +++ b/includes/class-wc-order-item-shipping.php @@ -130,7 +130,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_method_title( $value ) { - $this->set_prop( 'method_title', wc_clean( $value ) ); + $this->_data['method_title'] = wc_clean( $value ); } /** @@ -139,7 +139,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_method_id( $value ) { - $this->set_prop( 'method_id', wc_clean( $value ) ); + $this->_data['method_id'] = wc_clean( $value ); } /** @@ -148,7 +148,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_total( $value ) { - $this->set_prop( 'total', wc_format_decimal( $value ) ); + $this->_data['total'] = wc_format_decimal( $value ); } /** @@ -157,7 +157,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @throws WC_Data_Exception */ protected function set_total_tax( $value ) { - $this->set_prop( 'total_tax', wc_format_decimal( $value ) ); + $this->_data['total_tax'] = wc_format_decimal( $value ); } /** @@ -175,7 +175,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { if ( ! empty( $raw_tax_data['total'] ) ) { $tax_data['total'] = array_map( 'wc_format_decimal', $raw_tax_data['total'] ); } - $this->set_prop( 'taxes', $tax_data ); + $this->_data['taxes'] = $tax_data; $this->set_total_tax( array_sum( $tax_data['total'] ) ); } @@ -219,7 +219,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @return string */ public function get_method_title() { - return $this->get_prop( 'method_title' ) ? $this->get_prop( 'method_title' ) : __( 'Shipping', 'woocommerce' ); + return $this->_data['method_title'] ? $this->_data['method_title'] : __( 'Shipping', 'woocommerce' ); } /** @@ -227,7 +227,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @return string */ public function get_method_id() { - return $this->get_prop( 'method_id' ); + return $this->_data['method_id']; } /** @@ -235,7 +235,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @return string */ public function get_total() { - return wc_format_decimal( $this->get_prop( 'total' ) ); + return wc_format_decimal( $this->_data['total'] ); } /** @@ -243,7 +243,7 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @return string */ public function get_total_tax() { - return wc_format_decimal( $this->get_prop( 'total_tax' ) ); + return wc_format_decimal( $this->_data['total_tax'] ); } /** @@ -251,6 +251,6 @@ class WC_Order_Item_Shipping extends WC_Order_Item { * @return array */ public function get_taxes() { - return $this->get_prop( 'taxes' ); + return $this->_data['taxes']; } } diff --git a/includes/class-wc-order-item-tax.php b/includes/class-wc-order-item-tax.php index f695ea6ad31..4b77167bc9c 100644 --- a/includes/class-wc-order-item-tax.php +++ b/includes/class-wc-order-item-tax.php @@ -102,7 +102,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_rate_code( $value ) { - $this->set_prop( 'rate_code', wc_clean( $value ) ); + $this->_data['rate_code'] = wc_clean( $value ); } /** @@ -111,7 +111,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_label( $value ) { - $this->set_prop( 'label', wc_clean( $value ) ); + $this->_data['label'] = wc_clean( $value ); } /** @@ -120,7 +120,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_rate_id( $value ) { - $this->set_prop( 'rate_id', absint( $value ) ); + $this->_data['rate_id'] = absint( $value ); } /** @@ -129,7 +129,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_tax_total( $value ) { - $this->set_prop( 'tax_total', wc_format_decimal( $value ) ); + $this->_data['tax_total'] = wc_format_decimal( $value ); } /** @@ -138,7 +138,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_shipping_tax_total( $value ) { - $this->set_prop( 'shipping_tax_total', wc_format_decimal( $value ) ); + $this->_data['shipping_tax_total'] = wc_format_decimal( $value ); } /** @@ -147,7 +147,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @throws WC_Data_Exception */ public function set_compound( $value ) { - $this->set_prop( 'compound', (bool) $value ); + $this->_data['compound'] = (bool) $value; } /** @@ -189,7 +189,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @return string */ public function get_rate_code() { - return $this->get_prop( 'rate_code' ); + return $this->_data['rate_code']; } /** @@ -197,7 +197,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @return string */ public function get_label() { - return $this->get_prop( 'label' ) ? $this->get_prop( 'label' ) : __( 'Tax', 'woocommerce' ); + return $this->_data['label'] ? $this->_data['label'] : __( 'Tax', 'woocommerce'); } /** @@ -205,7 +205,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @return int */ public function get_rate_id() { - return absint( $this->get_prop( 'rate_id' ) ); + return absint( $this->_data['rate_id'] ); } /** @@ -213,7 +213,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @return string */ public function get_tax_total() { - return wc_format_decimal( $this->get_prop( 'tax_total' ) ); + return wc_format_decimal( $this->_data['tax_total'] ); } /** @@ -221,7 +221,7 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @return string */ public function get_shipping_tax_total() { - return wc_format_decimal( $this->get_prop( 'shipping_tax_total' ) ); + return wc_format_decimal( $this->_data['shipping_tax_total'] ); } /** @@ -229,6 +229,6 @@ class WC_Order_Item_Tax extends WC_Order_Item { * @return bool */ public function get_compound() { - return (bool) $this->get_prop( 'compound' ); + return (bool) $this->_data['compound']; } } diff --git a/includes/class-wc-order-item.php b/includes/class-wc-order-item.php index ebc27b44343..95d26bf553e 100644 --- a/includes/class-wc-order-item.php +++ b/includes/class-wc-order-item.php @@ -105,7 +105,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @return int */ public function get_id() { - return $this->get_prop( 'id' ); + return $this->_data['id']; } /** @@ -113,7 +113,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @return int */ public function get_order_id() { - return $this->get_prop( 'order_id' ); + return $this->_data['order_id']; } /** @@ -121,7 +121,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @return string */ public function get_name() { - return $this->get_prop( 'name' ); + return $this->_data['name']; } /** @@ -129,7 +129,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @return string */ public function get_type() { - return $this->get_prop( 'type' ); + return $this->_data['type']; } /* @@ -144,7 +144,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @throws WC_Data_Exception */ public function set_id( $value ) { - $this->set_prop( 'id', absint( $value ) ); + $this->_data['id'] = absint( $value ); } /** @@ -153,7 +153,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @throws WC_Data_Exception */ public function set_order_id( $value ) { - $this->set_prop( 'order_id', absint( $value ) ); + $this->_data['order_id'] = absint( $value ); } /** @@ -162,7 +162,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @throws WC_Data_Exception */ public function set_name( $value ) { - $this->set_prop( 'name', wc_clean( $value ) ); + $this->_data['name'] = wc_clean( $value ); } /** @@ -171,7 +171,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { * @throws WC_Data_Exception */ protected function set_type( $value ) { - $this->set_prop( 'type', wc_clean( $value ) ); + $this->_data['type'] = wc_clean( $value ); } /* diff --git a/includes/class-wc-order-refund.php b/includes/class-wc-order-refund.php index 8d4d62dce36..16b7942910b 100644 --- a/includes/class-wc-order-refund.php +++ b/includes/class-wc-order-refund.php @@ -118,7 +118,7 @@ class WC_Order_Refund extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_amount( $value ) { - $this->set_prop( 'amount', wc_format_decimal( $value ) ); + $this->_data['amount'] = wc_format_decimal( $value ); } /** @@ -126,7 +126,7 @@ class WC_Order_Refund extends WC_Abstract_Order { * @return int|float */ public function get_amount() { - return apply_filters( 'woocommerce_refund_amount', (double) $this->get_prop( 'amount' ), $this ); + return apply_filters( 'woocommerce_refund_amount', (double) $this->_data['amount'], $this ); } /** @@ -144,7 +144,7 @@ class WC_Order_Refund extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_reason( $value ) { - $this->set_prop( 'reason', $value ); + $this->_data['reason'] = $value; } /** @@ -153,7 +153,7 @@ class WC_Order_Refund extends WC_Abstract_Order { * @return int|float */ public function get_reason() { - return apply_filters( 'woocommerce_refund_reason', $this->get_prop( 'reason' ), $this ); + return apply_filters( 'woocommerce_refund_reason', $this->_data['reason'], $this ); } /** @@ -162,7 +162,7 @@ class WC_Order_Refund extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_refunded_by( $value ) { - $this->set_prop( 'refunded_by', absint( $value ) ); + $this->_data['refunded_by'] = absint( $value ); } /** @@ -171,7 +171,7 @@ class WC_Order_Refund extends WC_Abstract_Order { * @return int */ public function get_refunded_by() { - return absint( $this->get_prop( 'refunded_by' ) ); + return absint( $this->_data['refunded_by'] ); } /** diff --git a/includes/class-wc-order.php b/includes/class-wc-order.php index f60530140b4..66ed17608ff 100644 --- a/includes/class-wc-order.php +++ b/includes/class-wc-order.php @@ -500,7 +500,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_order_key() { - return $this->get_prop( 'order_key' ); + return $this->_data['order_key']; } /** @@ -508,7 +508,7 @@ class WC_Order extends WC_Abstract_Order { * @return int */ public function get_customer_id() { - return $this->get_prop( 'customer_id' ); + return $this->_data['customer_id']; } /** @@ -532,7 +532,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_first_name() { - return $this->get_prop( 'billing', 'first_name' ); + return $this->_data['billing']['first_name']; } /** @@ -540,7 +540,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_last_name() { - return $this->get_prop( 'billing', 'last_name' ); + return $this->_data['billing']['last_name']; } /** @@ -548,7 +548,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_company() { - return $this->get_prop( 'billing', 'company' ); + return $this->_data['billing']['company']; } /** @@ -556,7 +556,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_address_1() { - return $this->get_prop( 'billing', 'address_1' ); + return $this->_data['billing']['address_1']; } /** @@ -564,7 +564,7 @@ class WC_Order extends WC_Abstract_Order { * @return string $value */ public function get_billing_address_2() { - return $this->get_prop( 'billing', 'address_2' ); + return $this->_data['billing']['address_2']; } /** @@ -572,7 +572,7 @@ class WC_Order extends WC_Abstract_Order { * @return string $value */ public function get_billing_city() { - return $this->get_prop( 'billing', 'city' ); + return $this->_data['billing']['city']; } /** @@ -580,7 +580,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_state() { - return $this->get_prop( 'billing', 'state' ); + return $this->_data['billing']['state']; } /** @@ -588,7 +588,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_postcode() { - return $this->get_prop( 'billing', 'postcode' ); + return $this->_data['billing']['postcode']; } /** @@ -596,7 +596,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_country() { - return $this->get_prop( 'billing', 'country' ); + return $this->_data['billing']['country']; } /** @@ -604,7 +604,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_email() { - return $this->get_prop( 'billing', 'email' ); + return $this->_data['billing']['email']; } /** @@ -612,7 +612,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_billing_phone() { - return $this->get_prop( 'billing', 'phone' ); + return $this->_data['billing']['phone']; } /** @@ -620,7 +620,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_first_name() { - return $this->get_prop( 'shipping', 'first_name' ); + return $this->_data['shipping']['first_name']; } /** @@ -628,7 +628,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_last_name() { - return $this->get_prop( 'shipping', 'last_name' ); + return $this->_data['shipping']['last_name']; } /** @@ -636,7 +636,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_company() { - return $this->get_prop( 'shipping', 'company' ); + return $this->_data['shipping']['company']; } /** @@ -644,7 +644,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_address_1() { - return $this->get_prop( 'shipping', 'address_1' ); + return $this->_data['shipping']['address_1']; } /** @@ -652,7 +652,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_address_2() { - return $this->get_prop( 'shipping', 'address_2' ); + return $this->_data['shipping']['address_2']; } /** @@ -660,7 +660,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_city() { - return $this->get_prop( 'shipping', 'city' ); + return $this->_data['shipping']['city']; } /** @@ -668,7 +668,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_state() { - return $this->get_prop( 'shipping', 'state' ); + return $this->_data['shipping']['state']; } /** @@ -676,7 +676,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_postcode() { - return $this->get_prop( 'shipping', 'postcode' ); + return $this->_data['shipping']['postcode']; } /** @@ -684,7 +684,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_shipping_country() { - return $this->get_prop( 'shipping', 'country' ); + return $this->_data['shipping']['country']; } /** @@ -692,7 +692,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_payment_method() { - return $this->get_prop( 'payment_method' ); + return $this->_data['payment_method']; } /** @@ -700,7 +700,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_payment_method_title() { - return $this->get_prop( 'payment_method_title' ); + return $this->_data['payment_method_title']; } /** @@ -708,7 +708,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_transaction_id() { - return $this->get_prop( 'transaction_id' ); + return $this->_data['transaction_id']; } /** @@ -716,7 +716,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_customer_ip_address() { - return $this->get_prop( 'customer_ip_address' ); + return $this->_data['customer_ip_address']; } /** @@ -724,7 +724,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_customer_user_agent() { - return $this->get_prop( 'customer_user_agent' ); + return $this->_data['customer_user_agent']; } /** @@ -732,7 +732,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_created_via() { - return $this->get_prop( 'created_via' ); + return $this->_data['created_via']; } /** @@ -740,7 +740,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_customer_note() { - return $this->get_prop( 'customer_note' ); + return $this->_data['customer_note']; } /** @@ -748,7 +748,7 @@ class WC_Order extends WC_Abstract_Order { * @return int */ public function get_date_completed() { - return absint( $this->get_prop( 'date_completed' ) ); + return absint( $this->_data['date_completed'] ); } /** @@ -756,7 +756,7 @@ class WC_Order extends WC_Abstract_Order { * @return int */ public function get_date_paid() { - return absint( $this->get_prop( 'date_paid' ) ); + return absint( $this->_data['date_paid'] ); } /** @@ -820,7 +820,7 @@ class WC_Order extends WC_Abstract_Order { * @return string */ public function get_cart_hash() { - return $this->get_prop( 'cart_hash' ); + return $this->_data['cart_hash']; } /* @@ -841,7 +841,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_order_key( $value ) { - $this->set_prop( 'order_key', substr( $value, 0, 20 ) ); + $this->_data['order_key'] = substr( $value, 0, 20 ); } /** @@ -850,7 +850,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_customer_id( $value ) { - $this->set_prop( 'customer_id', absint( $value ) ); + $this->_data['customer_id'] = absint( $value ); } /** @@ -859,7 +859,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_first_name( $value ) { - $this->set_prop( 'billing', 'first_name', $value ); + $this->_data['billing']['first_name'] = $value; } /** @@ -868,7 +868,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_last_name( $value ) { - $this->set_prop( 'billing', 'last_name', $value ); + $this->_data['billing']['last_name'] = $value; } /** @@ -877,7 +877,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_company( $value ) { - $this->set_prop( 'billing', 'company', $value ); + $this->_data['billing']['company'] = $value; } /** @@ -886,7 +886,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_address_1( $value ) { - $this->set_prop( 'billing', 'address_1', $value ); + $this->_data['billing']['address_1'] = $value; } /** @@ -895,7 +895,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_address_2( $value ) { - $this->set_prop( 'billing', 'address_2', $value ); + $this->_data['billing']['address_2'] = $value; } /** @@ -904,7 +904,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_city( $value ) { - $this->set_prop( 'billing', 'city', $value ); + $this->_data['billing']['city'] = $value; } /** @@ -913,7 +913,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_state( $value ) { - $this->set_prop( 'billing', 'state', $value ); + $this->_data['billing']['state'] = $value; } /** @@ -922,7 +922,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_postcode( $value ) { - $this->set_prop( 'billing', 'postcode', $value ); + $this->_data['billing']['postcode'] = $value; } /** @@ -931,7 +931,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_country( $value ) { - $this->set_prop( 'billing', 'country', $value ); + $this->_data['billing']['country'] = $value; } /** @@ -956,7 +956,7 @@ class WC_Order extends WC_Abstract_Order { if ( $value && ! is_email( $value ) ) { $this->error( 'order_invalid_billing_email', __( 'Invalid order billing email address', 'woocommerce' ) ); } - $this->set_prop( 'billing', 'email', sanitize_email( $value ) ); + $this->_data['billing']['email'] = sanitize_email( $value ); } /** @@ -965,7 +965,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_billing_phone( $value ) { - $this->set_prop( 'billing', 'phone', $value ); + $this->_data['billing']['phone'] = $value; } /** @@ -974,7 +974,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_first_name( $value ) { - $this->set_prop( 'shipping', 'first_name', $value ); + $this->_data['shipping']['first_name'] = $value; } /** @@ -983,7 +983,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_last_name( $value ) { - $this->set_prop( 'shipping', 'last_name', $value ); + $this->_data['shipping']['last_name'] = $value; } /** @@ -992,7 +992,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_company( $value ) { - $this->set_prop( 'shipping', 'company', $value ); + $this->_data['shipping']['company'] = $value; } /** @@ -1001,7 +1001,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_address_1( $value ) { - $this->set_prop( 'shipping', 'address_1', $value ); + $this->_data['shipping']['address_1'] = $value; } /** @@ -1010,7 +1010,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_address_2( $value ) { - $this->set_prop( 'shipping', 'address_2', $value ); + $this->_data['shipping']['address_2'] = $value; } /** @@ -1019,7 +1019,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_city( $value ) { - $this->set_prop( 'shipping', 'city', $value ); + $this->_data['shipping']['city'] = $value; } /** @@ -1028,7 +1028,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_state( $value ) { - $this->set_prop( 'shipping', 'state', $value ); + $this->_data['shipping']['state'] = $value; } /** @@ -1037,7 +1037,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_postcode( $value ) { - $this->set_prop( 'shipping', 'postcode', $value ); + $this->_data['shipping']['postcode'] = $value; } /** @@ -1046,7 +1046,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_shipping_country( $value ) { - $this->set_prop( 'shipping', 'country', $value ); + $this->_data['shipping']['country'] = $value; } /** @@ -1059,10 +1059,10 @@ class WC_Order extends WC_Abstract_Order { $this->set_payment_method( $payment_method->id ); $this->set_payment_method_title( $payment_method->get_title() ); } elseif ( '' === $payment_method ) { - $this->set_prop( 'payment_method', '' ); - $this->set_prop( 'payment_method_title', '' ); + $this->_data['payment_method'] = ''; + $this->_data['payment_method_title'] = ''; } else { - $this->set_prop( 'payment_method', $payment_method ); + $this->_data['payment_method'] = $payment_method; } } @@ -1072,7 +1072,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_payment_method_title( $value ) { - $this->set_prop( 'payment_method_title', $value ); + $this->_data['payment_method_title'] = $value; } /** @@ -1081,7 +1081,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_transaction_id( $value ) { - $this->set_prop( 'transaction_id', $value ); + $this->_data['transaction_id'] = $value; } /** @@ -1090,7 +1090,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_customer_ip_address( $value ) { - $this->set_prop( 'customer_ip_address', $value ); + $this->_data['customer_ip_address'] = $value; } /** @@ -1099,7 +1099,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_customer_user_agent( $value ) { - $this->set_prop( 'customer_user_agent', $value ); + $this->_data['customer_user_agent'] = $value; } /** @@ -1108,7 +1108,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_created_via( $value ) { - $this->set_prop( 'created_via', $value ); + $this->_data['created_via'] = $value; } /** @@ -1117,7 +1117,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_customer_note( $value ) { - $this->set_prop( 'customer_note', $value ); + $this->_data['customer_note'] = $value; } /** @@ -1126,7 +1126,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_date_completed( $timestamp ) { - $this->set_prop( 'date_completed', is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ) ); + $this->_data['date_completed'] = is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ); } /** @@ -1135,7 +1135,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_date_paid( $timestamp ) { - $this->set_prop( 'date_paid', is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ) ); + $this->_data['date_paid'] = is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp ); } /** @@ -1144,7 +1144,7 @@ class WC_Order extends WC_Abstract_Order { * @throws WC_Data_Exception */ public function set_cart_hash( $value ) { - $this->set_prop( 'cart_hash', $value ); + $this->_data['cart_hash'] = $value; } /* diff --git a/tests/framework/class-wc-mock-wc-data.php b/tests/framework/class-wc-mock-wc-data.php index 216576057fc..16ad2d54ec2 100644 --- a/tests/framework/class-wc-mock-wc-data.php +++ b/tests/framework/class-wc-mock-wc-data.php @@ -76,7 +76,7 @@ class WC_Mock_WC_Data extends WC_Data { * @return string */ public function get_content() { - return $this->get_prop( 'content' ); + return $this->_data['content']; } /** @@ -84,7 +84,7 @@ class WC_Mock_WC_Data extends WC_Data { * @param string $content */ public function set_content( $content ) { - $this->set_prop( 'content', $content ); + $this->_data['content'] = $content; } /** @@ -92,7 +92,7 @@ class WC_Mock_WC_Data extends WC_Data { * @return bool */ public function get_bool_value() { - return $this->get_prop( 'bool_value' ); + return $this->_data['bool_value']; } /** @@ -103,7 +103,7 @@ class WC_Mock_WC_Data extends WC_Data { if ( ! is_bool( $value ) ) { $this->error( 'invalid_bool_value', 'O noes' ); } - $this->set_prop( 'bool_value', $value ); + $this->_data['bool_value'] = $value; } /**