PSR-4ify WC_Admin_Order class.

This commit is contained in:
Jeff Stieler 2019-07-31 11:24:01 -06:00
parent fab3d8e2cf
commit 54d0768892
3 changed files with 14 additions and 6 deletions

View File

@ -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/"
}
}
}

View File

@ -7,6 +7,8 @@
defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\WC_Admin_Order;
/**
* WC_Admin_Reports_Sync Class.
*/

View File

@ -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 );
}
/**