Skip to content

Commit

Permalink
Unnecessary "use" statements removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
kidunot89 committed Jul 11, 2019
1 parent 74bb15f commit 158e7ff
Show file tree
Hide file tree
Showing 28 changed files with 82 additions and 180 deletions.
1 change: 0 additions & 1 deletion includes/class-core-schema-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use WPGraphQL\Extensions\WooCommerce\Data\Connection\Post_Connection_Resolver;
use WPGraphQL\Extensions\WooCommerce\Data\Connection\WC_Terms_Connection_Resolver;
use WPGraphQL\Extensions\WooCommerce\Data\Factory;
use WPGraphQL\Extensions\WooCommerce\Data\Loader\WC_Customer_Loader;
use WPGraphQL\Extensions\WooCommerce\Data\Loader\WC_Post_Crud_Loader;

Expand Down
205 changes: 67 additions & 138 deletions includes/class-type-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,6 @@

namespace WPGraphQL\Extensions\WooCommerce;

use WPGraphQL\AppContext;
use WPGraphQL\Data\DataSource;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Backorders;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Catalog_Visibility;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Countries;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Customer_Connection_Orderby_Enum;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Discount_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Manage_Stock;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Order_Status;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Product_Types;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Stock_Status;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Class;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Status;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\WC_Connection_Orderby_Enum;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Rate_Connection_Orderby_Enum;
use WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Pricing_Field_Format;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Customer_Address_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Product_Attribute_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\WC_Connection_Orderby_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Tax_Rate_Connection_Orderby_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Fee_Line_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Line_Item_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Meta_Data_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Shipping_Line_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Create_Account_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Cart_Item_Quantity_Input;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Coupon_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Order_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Order_Item_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Refund_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Variation_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Attribute_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Download_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Customer_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Customer_Address_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Tax_Rate_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Shipping_Method_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Cart_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Variation_Attribute_Type;
use WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Category_Type;
use WPGraphQL\Extensions\WooCommerce\Connection\Posts;
use WPGraphQL\Extensions\WooCommerce\Connection\WC_Terms;
use WPGraphQL\Extensions\WooCommerce\Connection\Coupons;
use WPGraphQL\Extensions\WooCommerce\Connection\Products;
use WPGraphQL\Extensions\WooCommerce\Connection\Orders;
use WPGraphQL\Extensions\WooCommerce\Connection\Order_Items;
use WPGraphQL\Extensions\WooCommerce\Connection\Refunds;
use WPGraphQL\Extensions\WooCommerce\Connection\Product_Attributes;
use WPGraphQL\Extensions\WooCommerce\Connection\Variation_Attributes;
use WPGraphQL\Extensions\WooCommerce\Connection\Product_Gallery;
use WPGraphQL\Extensions\WooCommerce\Connection\Customers;
use WPGraphQL\Extensions\WooCommerce\Connection\Tax_Rates;
use WPGraphQL\Extensions\WooCommerce\Connection\Shipping_Methods;
use WPGraphQL\Extensions\WooCommerce\Connection\Cart_Items;
use WPGraphQL\Extensions\WooCommerce\Mutation\Customer_Register;
use WPGraphQL\Extensions\WooCommerce\Mutation\Customer_Update;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Add_Item;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Update_Item_Quantities;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Remove_Items;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Restore_Items;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Empty;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Apply_Coupon;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Remove_Coupons;
use WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Add_Fee;
use WPGraphQL\Extensions\WooCommerce\Mutation\Order_Create;
use WPGraphQL\Extensions\WooCommerce\Mutation\Order_Update;
use WPGraphQL\Extensions\WooCommerce\Mutation\Order_Delete;
use WPGraphQL\Extensions\WooCommerce\Mutation\Order_Delete_Items;
use WPGraphQL\Extensions\WooCommerce\Mutation\Checkout;

/**
* Class Type_Registry
*/
Expand All @@ -96,82 +25,82 @@ public static function add_actions() {
*/
public static function graphql_register_types() {
// Enumerations.
Backorders::register();
Catalog_Visibility::register();
Countries::register();
Customer_Connection_Orderby_Enum::register();
Discount_Type::register();
Manage_Stock::register();
Order_Status::register();
Product_Types::register();
Stock_Status::register();
Tax_Class::register();
Tax_Status::register();
WC_Connection_Orderby_Enum::register();
Tax_Rate_Connection_Orderby_Enum::register();
Pricing_Field_Format::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Backorders::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Catalog_Visibility::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Countries::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Customer_Connection_Orderby_Enum::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Discount_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Manage_Stock::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Order_Status::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Product_Types::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Stock_Status::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Class::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Status::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\WC_Connection_Orderby_Enum::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Tax_Rate_Connection_Orderby_Enum::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPEnum\Pricing_Field_Format::register();

// InputObjects.
Customer_Address_Input::register();
Product_Attribute_Input::register();
WC_Connection_Orderby_Input::register();
Tax_Rate_Connection_Orderby_Input::register();
Fee_Line_Input::register();
Line_Item_Input::register();
Meta_Data_Input::register();
Shipping_Line_Input::register();
Create_Account_Input::register();
Cart_Item_Quantity_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Customer_Address_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Product_Attribute_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\WC_Connection_Orderby_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Tax_Rate_Connection_Orderby_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Fee_Line_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Line_Item_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Meta_Data_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Shipping_Line_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Create_Account_Input::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPInputObject\Cart_Item_Quantity_Input::register();

// Objects.
Coupon_Type::register();
Product_Type::register();
Product_Variation_Type::register();
Order_Type::register();
Order_Item_Type::register();
Refund_Type::register();
Product_Attribute_Type::register();
Product_Download_Type::register();
Customer_Type::register();
Customer_Address_Type::register();
Tax_Rate_Type::register();
Shipping_Method_Type::register();
Cart_Type::register();
Variation_Attribute_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Coupon_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Variation_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Order_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Order_Item_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Refund_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Attribute_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Download_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Customer_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Customer_Address_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Tax_Rate_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Shipping_Method_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Cart_Type::register();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Variation_Attribute_Type::register();

// Object fields.
Product_Category_Type::register_fields();
\WPGraphQL\Extensions\WooCommerce\Type\WPObject\Product_Category_Type::register_fields();

// Connections.
Posts::register_connections();
WC_Terms::register_connections();
Coupons::register_connections();
Products::register_connections();
Orders::register_connections();
Order_Items::register_connections();
Refunds::register_connections();
Product_Attributes::register_connections();
Variation_Attributes::register_connections();
Customers::register_connections();
Tax_Rates::register_connections();
Shipping_Methods::register_connections();
Cart_Items::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Posts::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\WC_Terms::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Coupons::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Products::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Orders::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Order_Items::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Refunds::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Product_Attributes::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Variation_Attributes::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Customers::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Tax_Rates::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Shipping_Methods::register_connections();
\WPGraphQL\Extensions\WooCommerce\Connection\Cart_Items::register_connections();

// Mutations.
Customer_Register::register_mutation();
Customer_Update::register_mutation();
Cart_Add_Item::register_mutation();
Cart_Update_Item_Quantities::register_mutation();
Cart_Remove_Items::register_mutation();
Cart_Restore_Items::register_mutation();
Cart_Empty::register_mutation();
Cart_Apply_Coupon::register_mutation();
Cart_Remove_Coupons::register_mutation();
Cart_Add_Fee::register_mutation();
Order_Create::register_mutation();
Order_Update::register_mutation();
Order_Delete::register_mutation();
Order_Delete_Items::register_mutation();
Checkout::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Customer_Register::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Customer_Update::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Add_Item::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Update_Item_Quantities::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Remove_Items::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Restore_Items::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Empty::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Apply_Coupon::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Remove_Coupons::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Cart_Add_Fee::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Order_Create::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Order_Update::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Order_Delete::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Order_Delete_Items::register_mutation();
\WPGraphQL\Extensions\WooCommerce\Mutation\Checkout::register_mutation();
}
}
2 changes: 0 additions & 2 deletions includes/connection/class-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

namespace WPGraphQL\Extensions\WooCommerce\Connection;

use WPGraphQL\Data\DataSource;
use WPGraphQL\Connection\PostObjects;
use WPGraphQL\Extensions\WooCommerce\Data\Factory;

/**
* Class - Posts
Expand Down
2 changes: 0 additions & 2 deletions includes/connection/class-wc-terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

namespace WPGraphQL\Extensions\WooCommerce\Connection;

use WPGraphQL\Data\DataSource;
use WPGraphQL\Connection\TermObjects;
use WPGraphQL\Extensions\WooCommerce\Data\Factory;

/**
* Class - WC_Terms
Expand Down
1 change: 0 additions & 1 deletion includes/data/class-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use GraphQL\Deferred;
use GraphQL\Error\UserError;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQLRelay\Relay;
use WPGraphQL\AppContext;
use WPGraphQL\Extensions\WooCommerce\Data\Connection\Coupon_Connection_Resolver;
use WPGraphQL\Extensions\WooCommerce\Data\Connection\Customer_Connection_Resolver;
Expand Down
2 changes: 0 additions & 2 deletions includes/data/connection/class-coupon-connection-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Data\Connection\AbstractConnectionResolver;
use WPGraphQL\Extensions\WooCommerce\Model\Customer;
use WPGraphQL\Extension\WooCommerce\Model\Order;
use WPGraphQL\Extensions\WooCommerce\Model\Refund;

/**
* Class Coupon_Connection_Resolver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace WPGraphQL\Extensions\WooCommerce\Data\Connection;

use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Data\Connection\AbstractConnectionResolver;
use WPGraphQL\Extensions\WooCommerce\Model\Coupon;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Data\Connection\AbstractConnectionResolver;
use WPGraphQL\Extension\WooCommerce\Model\Order;
use WPGraphQL\Extensions\WooCommerce\Model\Customer;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace WPGraphQL\Extensions\WooCommerce\Data\Connection;

use WPGraphQL\Data\Connection\PostObjectConnectionResolver;
use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Extensions\WooCommerce\Model\Product;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use WPGraphQL\AppContext;
use WPGraphQL\Extensions\WooCommerce\Model\Coupon;
use WPGraphQL\Extensions\WooCommerce\Model\Customer;
use WPGraphQL\Extensions\WooCommerce\Model\Order;
use WPGraphQL\Extensions\WooCommerce\Model\Product;
use WPGraphQL\Model\Term;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Variation_Attribute_Connection_Resolver {
* Returns data array from WC_Product_Attribute ArrayAccess object.
*
* @param WC_Product_Attribute $attrs - WC_Product_Attribute object.
* @param string $variation_id - ProductVariation Relay ID.
* @param string $parent_id - ProductVariation Relay ID.
*
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace WPGraphQL\Extensions\WooCommerce\Data\Connection;

use WPGraphQL\Data\Connection\TermObjectConnectionResolver;
use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Extensions\WooCommerce\Model\Coupon;
Expand Down
1 change: 0 additions & 1 deletion includes/model/class-customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace WPGraphQL\Extensions\WooCommerce\Model;

use GraphQLRelay\Relay;
use WPGraphQL\Data\DataSource;
use WPGraphQL\Model\Model;

/**
Expand Down
1 change: 0 additions & 1 deletion includes/model/class-product-variation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace WPGraphQL\Extensions\WooCommerce\Model;

use GraphQLRelay\Relay;
use WPGraphQL\Data\DataSource;

/**
* Class Product_Variation
Expand Down
1 change: 0 additions & 1 deletion includes/model/trait-shop-manager-caps.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace WPGraphQL\Extensions\WooCommerce\Model;

use GraphQLRelay\Relay;
/**
* Trait Shop_Manager_Capabilities
*/
Expand Down
4 changes: 4 additions & 0 deletions includes/mutation/class-cart-empty.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ public static function mutate_and_get_payload() {
// Get WC_Cart instance.
$cloned_cart = clone \WC()->cart;

do_action( 'woocommerce_graphql_before_empty_cart', $cloned_cart, $input, $context, $info );

// Empty cart.
\WC()->cart->empty_cart();

do_action( 'woocommerce_graphql_after_empty_cart', $cloned_cart, $input, $context, $info );

return array( 'cart' => $cloned_cart );
};
}
Expand Down
2 changes: 1 addition & 1 deletion includes/mutation/class-customer-register.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use GraphQL\Error\UserError;
use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Mutation\UserRegister;
use WPGraphQL\Extensions\WooCommerce\Data\Mutation\Customer_Mutation;
use WPGraphQL\Extensions\WooCommerce\Model\Customer;
use WPGraphQL\Model\User;
use WPGraphQL\Mutation\UserRegister;

/**
* Class - Customer_Register
Expand Down
2 changes: 1 addition & 1 deletion includes/mutation/class-customer-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use GraphQL\Error\UserError;
use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Mutation\UserUpdate;
use WPGraphQL\Extensions\WooCommerce\Data\Mutation\Customer_Mutation;
use WPGraphQL\Extensions\WooCommerce\Model\Customer;
use WPGraphQL\Model\User;
use WPGraphQL\Mutation\UserUpdate;

/**
* Class - Customer_Update
Expand Down
2 changes: 0 additions & 2 deletions includes/type/enum/class-product-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

namespace WPGraphQL\Extensions\WooCommerce\Type\WPEnum;

use WPGraphQL\Type\WPEnumType;

/**
* Class Product_Types
*/
Expand Down
Loading

0 comments on commit 158e7ff

Please sign in to comment.