PSR-4ify WC_Admin_Order class.
This commit is contained in:
parent
fab3d8e2cf
commit
54d0768892
|
@ -39,6 +39,9 @@
|
|||
"includes/core-functions.php",
|
||||
"includes/feature-config.php",
|
||||
"includes/page-controller/page-controller-functions.php"
|
||||
]
|
||||
],
|
||||
"psr-4": {
|
||||
"Automattic\\WooCommerce\\Admin\\": "src/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use \Automattic\WooCommerce\Admin\WC_Admin_Order;
|
||||
|
||||
/**
|
||||
* WC_Admin_Reports_Sync Class.
|
||||
*/
|
||||
|
|
|
@ -7,16 +7,18 @@
|
|||
* @package WooCommerce Admin/Classes
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Admin_Order class.
|
||||
*/
|
||||
class WC_Admin_Order extends WC_Order {
|
||||
class WC_Admin_Order extends \WC_Order {
|
||||
/**
|
||||
* Order traits.
|
||||
*/
|
||||
use WC_Admin_Order_Trait;
|
||||
use \WC_Admin_Order_Trait;
|
||||
|
||||
/**
|
||||
* Holds refund amounts and quantities for the order.
|
||||
|
@ -42,8 +44,9 @@ class WC_Admin_Order extends WC_Order {
|
|||
* @return string
|
||||
*/
|
||||
public static function order_class_name( $classname, $order_type, $order_id ) {
|
||||
// @todo - Only substitute class when necessary (during sync).
|
||||
if ( 'WC_Order' === $classname ) {
|
||||
return 'WC_Admin_Order';
|
||||
return '\Automattic\WooCommerce\Admin\WC_Admin_Order';
|
||||
} else {
|
||||
return $classname;
|
||||
}
|
||||
|
@ -55,7 +58,7 @@ class WC_Admin_Order extends WC_Order {
|
|||
* @return int
|
||||
*/
|
||||
public function get_report_customer_id() {
|
||||
return WC_Admin_Reports_Customers_Data_Store::get_or_create_customer_from_order( $this );
|
||||
return \WC_Admin_Reports_Customers_Data_Store::get_or_create_customer_from_order( $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,7 +67,7 @@ class WC_Admin_Order extends WC_Order {
|
|||
* @return bool
|
||||
*/
|
||||
public function is_returning_customer() {
|
||||
return WC_Admin_Reports_Orders_Stats_Data_Store::is_returning_customer( $this );
|
||||
return \WC_Admin_Reports_Orders_Stats_Data_Store::is_returning_customer( $this );
|
||||
}
|
||||
|
||||
/**
|
Loading…
Reference in New Issue