Merge pull request #19266 from woocommerce/fix/phpcs-import

PHPCS fixes for import and interface directories
This commit is contained in:
Rodrigo Primo 2018-03-06 10:10:45 -03:00 committed by GitHub
commit 7cd28774b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 335 additions and 211 deletions

View File

@ -2,8 +2,6 @@
/**
* Abstract Product importer
*
* @author Automattic
* @category Admin
* @package WooCommerce/Import
* @version 3.1.0
*/

View File

@ -1,4 +1,11 @@
<?php
/**
* Order Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interfaces
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,16 +16,14 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by order store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Abstract_Order_Data_Store_Interface {
/**
* Read order items of a specific type from the database for this order.
*
* @param WC_Order $order
* @param string $type
* @param WC_Order $order Order object.
* @param string $type Order item type.
* @return array
*/
public function read_items( $order, $type );
@ -26,15 +31,15 @@ interface WC_Abstract_Order_Data_Store_Interface {
/**
* Remove all line items (products, coupons, shipping, taxes) from the order.
*
* @param WC_Order $order
* @param string $type Order item type. Default null.
* @param WC_Order $order Order object.
* @param string $type Order item type. Default null.
*/
public function delete_items( $order, $type = null );
/**
* Get token ids for an order.
*
* @param WC_Order $order
* @param WC_Order $order Order object.
* @return array
*/
public function get_payment_token_ids( $order );
@ -42,8 +47,8 @@ interface WC_Abstract_Order_Data_Store_Interface {
/**
* Update token ids for an order.
*
* @param WC_Order $order
* @param array $token_ids
* @param WC_Order $order Order object.
* @param array $token_ids Token IDs.
*/
public function update_payment_token_ids( $order, $token_ids );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Coupon Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interfaces
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,44 +16,47 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by coupon store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Coupon_Data_Store_Interface {
/**
* Increase usage count for current coupon.
* @param WC_Coupon &$coupon
* @param string $used_by Either user ID or billing email
*
* @param WC_Coupon $coupon Coupon object.
* @param string $used_by Either user ID or billing email.
*/
public function increase_usage_count( &$coupon, $used_by = '' );
/**
* Decrease usage count for current coupon.
* @param WC_Coupon &$coupon
* @param string $used_by Either user ID or billing email
*
* @param WC_Coupon $coupon Coupon object.
* @param string $used_by Either user ID or billing email.
*/
public function decrease_usage_count( &$coupon, $used_by = '' );
/**
* Get the number of uses for a coupon by user ID.
* @param WC_Coupon &$coupon
* @param int $user_id
*
* @param WC_Coupon $coupon Coupon object.
* @param int $user_id User ID.
* @return int
*/
public function get_usage_by_user_id( &$coupon, $user_id );
/**
* Return a coupon code for a specific ID.
* @param int $id
* @return string Coupon Code
*
* @param int $id Coupon ID.
* @return string Coupon Code.
*/
public function get_code_by_id( $id );
public function get_code_by_id( $id );
/**
* Return an array of IDs for for a specific coupon code.
* Can return multiple to check for existence.
* @param string $code
* @return array Array of IDs.
*/
public function get_ids_by_code( $code );
/**
* Return an array of IDs for for a specific coupon code.
* Can return multiple to check for existence.
*
* @param string $code Coupon code.
* @return array Array of IDs.
*/
public function get_ids_by_code( $code );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Customer Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,15 +16,13 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by customer store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Customer_Data_Store_Interface {
/**
* Gets the customers last order.
*
* @param WC_Customer &$customer
* @param WC_Customer $customer Customer object.
* @return WC_Order|false
*/
public function get_last_order( &$customer );
@ -25,7 +30,7 @@ interface WC_Customer_Data_Store_Interface {
/**
* Return the number of orders this customer has.
*
* @param WC_Customer &$customer
* @param WC_Customer $customer Customer object.
* @return integer
*/
public function get_order_count( &$customer );
@ -33,7 +38,7 @@ interface WC_Customer_Data_Store_Interface {
/**
* Return how much money this customer has spent.
*
* @param WC_Customer &$customer
* @param WC_Customer $customer Customer object.
* @return float
*/
public function get_total_spent( &$customer );

View File

@ -1,4 +1,11 @@
<?php
/**
* Customer Download Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -7,36 +14,34 @@ if ( ! defined( 'ABSPATH' ) ) {
* WC Customer Download Data Store Interface.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Customer_Download_Data_Store_Interface {
/**
* Method to delete a download permission from the database by ID.
*
* @param int $id
* @param int $id Download Permission ID.
*/
public function delete_by_id( $id );
/**
* Method to delete a download permission from the database by order ID.
*
* @param int $id
* @param int $id Order ID.
*/
public function delete_by_order_id( $id );
/**
* Method to delete a download permission from the database by download ID.
*
* @param int $id
* @param int $id Download ID.
*/
public function delete_by_download_id( $id );
/**
* Get array of download ids by specified args.
*
* @param array $args
* @param array $args Arguments.
* @return array of WC_Customer_Download
*/
public function get_downloads( $args = array() );
@ -44,16 +49,16 @@ interface WC_Customer_Download_Data_Store_Interface {
/**
* Update download ids if the hash changes.
*
* @param int $product_id
* @param string $old_id
* @param string $new_id
* @param int $product_id Product ID.
* @param string $old_id Old ID.
* @param string $new_id New ID.
*/
public function update_download_id( $product_id, $old_id, $new_id );
/**
* Get a customers downloads.
*
* @param int $customer_id
* @param int $customer_id Customer ID.
* @return array
*/
public function get_downloads_for_customer( $customer_id );
@ -61,9 +66,9 @@ interface WC_Customer_Download_Data_Store_Interface {
/**
* Update user prop for downloads based on order id.
*
* @param int $order_id
* @param int $customer_id
* @param string $email
* @param int $order_id Order ID.
* @param int $customer_id Customer ID.
* @param string $email Email Address.
*/
public function update_user_by_order_id( $order_id, $customer_id, $email );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Customer Download Log Data Store Interface
*
* @version 3.3.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -7,15 +14,13 @@ if ( ! defined( 'ABSPATH' ) ) {
* WC Customer Download Log Data Store Interface.
*
* @version 3.3.0
* @category Interface
* @author WooThemes
*/
interface WC_Customer_Download_Log_Data_Store_Interface {
/**
* Get array of download log ids by specified args.
*
* @param array $args
* @param array $args Arguments.
* @return array of WC_Customer_Download_Log
*/
public function get_download_logs( $args = array() );
@ -23,7 +28,7 @@ interface WC_Customer_Download_Log_Data_Store_Interface {
/**
* Get logs for a specific download permission.
*
* @param int $permission_id
* @param int $permission_id Permission ID.
* @return array
*/
public function get_download_logs_for_permission( $permission_id );

View File

@ -2,11 +2,10 @@
/**
* WooCommerce Importer Interface
*
* @author Automattic
* @category Admin
* @package WooCommerce/Import
* @package WooCommerce/Interface
* @version 3.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

View File

@ -1,6 +1,13 @@
<?php
/**
* Log Handler Interface
*
* @version 3.3.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
/**
@ -8,19 +15,17 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* Functions that must be defined to correctly fulfill log handler API.
*
* @version 1.0.0
* @category Interface
* @author WooThemes
* @version 3.3.0
*/
interface WC_Log_Handler_Interface {
/**
* Handle a log entry.
*
* @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug
* @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @param string $message Log message.
* @param array $context Additional information for log handlers.
* @param array $context Additional information for log handlers.
*
* @return bool False if value was not handled and true if value was handled.
*/

View File

@ -1,6 +1,13 @@
<?php
/**
* Logger Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
/**
@ -8,9 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* Functions that must be defined to correctly fulfill logger API.
*
* @version 1.0.0
* @category Interface
* @author WooThemes
* @version 3.0.0
*/
interface WC_Logger_Interface {
@ -20,9 +25,9 @@ interface WC_Logger_Interface {
* This is not the preferred method for adding log messages. Please use log() or any one of
* the level methods (debug(), info(), etc.). This method may be deprecated in the future.
*
* @param string $handle
* @param string $message
* @param string $level
* @param string $handle File handle.
* @param string $message Log message.
* @param string $level Log level.
*
* @return bool True if log was added, otherwise false.
*/
@ -41,7 +46,7 @@ interface WC_Logger_Interface {
* 'info': Informational messages.
* 'debug': Debug-level messages.
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function log( $level, $message, $context = array() );
@ -51,7 +56,7 @@ interface WC_Logger_Interface {
* System is unusable.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function emergency( $message, $context = array() );
@ -62,7 +67,7 @@ interface WC_Logger_Interface {
* Example: Entire website down, database unavailable, etc.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function alert( $message, $context = array() );
@ -73,7 +78,7 @@ interface WC_Logger_Interface {
* Example: Application component unavailable, unexpected exception.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function critical( $message, $context = array() );
@ -84,7 +89,7 @@ interface WC_Logger_Interface {
* and monitored.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function error( $message, $context = array() );
@ -97,7 +102,7 @@ interface WC_Logger_Interface {
* necessarily wrong.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function warning( $message, $context = array() );
@ -107,7 +112,7 @@ interface WC_Logger_Interface {
* Normal but significant events.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function notice( $message, $context = array() );
@ -118,7 +123,7 @@ interface WC_Logger_Interface {
* Example: User logs in, SQL logs.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function info( $message, $context = array() );
@ -128,7 +133,7 @@ interface WC_Logger_Interface {
* Detailed debug information.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
* @param array $context Optional. Additional information for log handlers.
*/
public function debug( $message, $context = array() );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Object Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -7,63 +14,69 @@ if ( ! defined( 'ABSPATH' ) ) {
* WC Data Store Interface
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Object_Data_Store_Interface {
/**
* Method to create a new record of a WC_Data based object.
* @param WC_Data &$data
*
* @param WC_Data $data Data object.
*/
public function create( &$data );
/**
* Method to read a record. Creates a new WC_Data based object.
* @param WC_Data &$data
*
* @param WC_Data $data Data object.
*/
public function read( &$data );
/**
* Updates a record in the database.
* @param WC_Data &$data
*
* @param WC_Data $data Data object.
*/
public function update( &$data );
/**
* Deletes a record from the database.
* @param WC_Data &$data
* @param array $args Array of args to pass to the delete method.
*
* @param WC_Data $data Data object.
* @param array $args Array of args to pass to the delete method.
* @return bool result
*/
public function delete( &$data, $args = array() );
/**
* Returns an array of meta for an object.
* @param WC_Data &$data
*
* @param WC_Data $data Data object.
* @return array
*/
public function read_meta( &$data );
/**
* Deletes meta based on meta ID.
* @param WC_Data &$data
* @param object $meta (containing at least ->id)
*
* @param WC_Data $data Data object.
* @param object $meta Meta object (containing at least ->id).
* @return array
*/
public function delete_meta( &$data, $meta );
/**
* Add new piece of meta.
* @param WC_Data &$data
* @param object $meta (containing ->key and ->value)
*
* @param WC_Data $data Data object.
* @param object $meta Meta object (containing ->key and ->value).
* @return int meta ID
*/
public function add_meta( &$data, $meta );
/**
* Update meta.
* @param WC_Data &$data
* @param object $meta (containing ->id, ->key and ->value)
*
* @param WC_Data $data Data object.
* @param object $meta Meta object (containing ->id, ->key and ->value).
*/
public function update_meta( &$data, $meta );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Order Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,14 +16,12 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by order store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Order_Data_Store_Interface {
/**
* Get amount already refunded.
*
* @param WC_Order $order
* @param WC_Order $order Order object.
* @return string
*/
public function get_total_refunded( $order );
@ -24,7 +29,7 @@ interface WC_Order_Data_Store_Interface {
/**
* Get the total tax refunded.
*
* @param WC_Order $order
* @param WC_Order $order Order object.
* @return float
*/
public function get_total_tax_refunded( $order );
@ -32,7 +37,7 @@ interface WC_Order_Data_Store_Interface {
/**
* Get the total shipping refunded.
*
* @param WC_Order $order
* @param WC_Order $order Order object.
* @return float
*/
public function get_total_shipping_refunded( $order );
@ -40,14 +45,15 @@ interface WC_Order_Data_Store_Interface {
/**
* Finds an Order ID based on an order key.
*
* @param string $order_key An order key has generated by
* @return int The ID of an order, or 0 if the order could not be found
* @param string $order_key An order key has generated by.
* @return int The ID of an order, or 0 if the order could not be found.
*/
public function get_order_id_by_order_key( $order_key );
/**
* Return count of orders with a specific status.
* @param string $status
*
* @param string $status Order status.
* @return int
*/
public function get_order_count( $status );
@ -56,70 +62,79 @@ interface WC_Order_Data_Store_Interface {
* Get all orders matching the passed in args.
*
* @see wc_get_orders()
* @param array $args
* @param array $args Arguments.
* @return array of orders
*/
public function get_orders( $args = array() );
/**
* Get unpaid orders after a certain date,
* @param int $date timestamp
*
* @param int $date timestamp.
* @return array
*/
public function get_unpaid_orders( $date );
/**
* Search order data for a term and return ids.
* @param string $term
*
* @param string $term Term name.
* @return array of ids
*/
public function search_orders( $term );
/**
* Gets information about whether permissions were generated yet.
* @param WC_Order $order
*
* @param WC_Order $order Order object.
* @return bool
*/
public function get_download_permissions_granted( $order );
/**
* Stores information about whether permissions were generated yet.
* @param WC_Order $order
* @param bool $set
*
* @param WC_Order $order Order object.
* @param bool $set If should set.
*/
public function set_download_permissions_granted( $order, $set );
/**
* Gets information about whether sales were recorded.
* @param WC_Order $order
*
* @param WC_Order $order Order object.
* @return bool
*/
public function get_recorded_sales( $order );
/**
* Stores information about whether sales were recorded.
* @param WC_Order $order
* @param bool $set
*
* @param WC_Order $order Order object.
* @param bool $set If should set.
*/
public function set_recorded_sales( $order, $set );
/**
* Gets information about whether coupon counts were updated.
* @param WC_Order $order
*
* @param WC_Order $order Order object.
* @return bool
*/
public function get_recorded_coupon_usage_counts( $order );
/**
* Stores information about whether coupon counts were updated.
* @param WC_Order $order
* @param bool $set
*
* @param WC_Order $order Order object.
* @param bool $set If should set.
*/
public function set_recorded_coupon_usage_counts( $order, $set );
/**
* Get the order type based on Order ID.
* @param int $order_id
*
* @param int $order_id Order ID.
* @return string
*/
public function get_order_type( $order_id );

View File

@ -1,4 +1,11 @@
<?php
/**
* Order Item Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,14 +16,13 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by the order item data store (for functions).
*
* @version 3.0.0
* @category Interface
* @author WooCommerce
*/
interface WC_Order_Item_Data_Store_Interface {
/**
* Add an order item to an order.
* @param int $order_id
*
* @param int $order_id Order ID.
* @param array $item order_item_name and order_item_type.
* @return int Order Item ID
*/
@ -24,7 +30,8 @@ interface WC_Order_Item_Data_Store_Interface {
/**
* Update an order item.
* @param int $item_id
*
* @param int $item_id Item ID.
* @param array $item order_item_name or order_item_type.
* @return boolean
*/
@ -32,60 +39,67 @@ interface WC_Order_Item_Data_Store_Interface {
/**
* Delete an order item.
* @param int $item_id
*
* @param int $item_id Item ID.
*/
public function delete_order_item( $item_id );
/**
* Update term meta.
* @param int $item_id
* @param string $meta_key
* @param mixed $meta_value
* @param string $prev_value (default: '')
*
* @param int $item_id Item ID.
* @param string $meta_key Meta key.
* @param mixed $meta_value Meta value.
* @param string $prev_value Previous value (default: '').
* @return bool
*/
function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' );
public function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' );
/**
* Add term meta.
* @param int $item_id
* @param string $meta_key
* @param mixed $meta_value
* @param bool $unique (default: false)
*
* @param int $item_id Item ID.
* @param string $meta_key Meta key.
* @param mixed $meta_value Meta value.
* @param bool $unique Unique? (default: false).
* @return int New row ID or 0
*/
function add_metadata( $item_id, $meta_key, $meta_value, $unique = false );
public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false );
/**
* Delete term meta.
* @param int $item_id
* @param string $meta_key
* @param string $meta_value (default: '')
* @param bool $delete_all (default: false)
*
* @param int $item_id Item ID.
* @param string $meta_key Meta key.
* @param string $meta_value Meta value (default: '').
* @param bool $delete_all Delete all matching entries? (default: false).
* @return bool
*/
function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false );
public function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false );
/**
* Get term meta.
* @param int $item_id
* @param string $key
* @param bool $single (default: true)
*
* @param int $item_id Item ID.
* @param string $key Meta key.
* @param bool $single Store as single value and not serialised (default: true).
* @return mixed
*/
function get_metadata( $item_id, $key, $single = true );
public function get_metadata( $item_id, $key, $single = true );
/**
* Get order ID by order item ID.
* @param int $item_id
*
* @param int $item_id Item ID.
* @return int
*/
function get_order_id_by_order_item_id( $item_id );
public function get_order_id_by_order_item_id( $item_id );
/**
* Get the order item type based on Item ID.
* @param int $item_id
*
* @param int $item_id Item ID.
* @return string
*/
public function get_order_item_type( $item_id );

View File

@ -1,4 +1,11 @@
<?php
/**
* Order Item Product Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,16 +16,14 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by order item store classes.
*
* @version 3.0.0
* @category Interface
* @author WooCommerce
*/
interface WC_Order_Item_Product_Data_Store_Interface {
/**
* Get a list of download IDs for a specific item from an order.
*
* @param WC_Order_Item $item
* @param WC_Order $order
* @param WC_Order_Item $item Item object.
* @param WC_Order $order Order object.
* @return array
*/
public function get_download_ids( $item, $order );
public function get_download_ids( $item, $order );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Order Item Type Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,15 +16,13 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by order item store classes.
*
* @version 3.0.0
* @category Interface
* @author WooCommerce
*/
interface WC_Order_Item_Type_Data_Store_Interface {
/**
* Saves an item's data to the database / item meta.
* Ran after both create and update, so $item->get_id() will be set.
*
* @param WC_Order_Item $item
* @param WC_Order_Item $item Item object.
*/
public function save_item_data( &$item );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Order Refund Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,8 +16,6 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by order store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Order_Refund_Data_Store_Interface {
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Payment Token Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,15 +16,14 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by payment token store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Payment_Token_Data_Store_Interface {
/**
* Returns an array of objects (stdObject) matching specific token criteria.
* Accepts token_id, user_id, gateway_id, and type.
* Each object should contain the fields token_id, gateway_id, token, user_id, type, is_default.
* @param array $args
*
* @param array $args Arguments.
* @return array
*/
public function get_tokens( $args );
@ -25,7 +31,8 @@ interface WC_Payment_Token_Data_Store_Interface {
/**
* Returns an stdObject of a token for a user's default token.
* Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
* @param int $user_id
*
* @param int $user_id User ID.
* @return object
*/
public function get_users_default_token( $user_id );
@ -33,14 +40,16 @@ interface WC_Payment_Token_Data_Store_Interface {
/**
* Returns an stdObject of a token.
* Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
* @param int $token_id
*
* @param int $token_id Token ID.
* @return object
*/
public function get_token_by_id( $token_id );
/**
* Returns metadata for a specific payment token.
* @param int $token_id
*
* @param int $token_id Token ID.
* @return array
*/
public function get_metadata( $token_id );
@ -48,8 +57,7 @@ interface WC_Payment_Token_Data_Store_Interface {
/**
* Get a token's type by ID.
*
* @since 3.0.0
* @param int $token_id
* @param int $token_id Token ID.
* @return string
*/
public function get_token_type_by_id( $token_id );
@ -58,8 +66,9 @@ interface WC_Payment_Token_Data_Store_Interface {
* Update's a tokens default status in the database. Used for quickly
* looping through tokens and setting their statuses instead of creating a bunch
* of objects.
* @param int $token_id
* @param bool $status
*
* @param int $token_id Token ID.
* @param bool $status If should update status.
* @return string
*/
public function set_default_status( $token_id, $status = true );

View File

@ -1,4 +1,11 @@
<?php
/**
* Product Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,8 +16,6 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by product store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Product_Data_Store_Interface {
@ -34,8 +39,8 @@ interface WC_Product_Data_Store_Interface {
/**
* Check if product sku is found for any other product IDs.
*
* @param int $product_id
* @param string $sku
* @param int $product_id Product ID.
* @param string $sku SKU.
* @return bool
*/
public function is_existing_sku( $product_id, $sku );
@ -43,7 +48,7 @@ interface WC_Product_Data_Store_Interface {
/**
* Return product ID based on SKU.
*
* @param string $sku
* @param string $sku SKU.
* @return int
*/
public function get_product_id_by_sku( $sku );
@ -65,8 +70,8 @@ interface WC_Product_Data_Store_Interface {
/**
* Find a matching (enabled) variation within a variable product.
*
* @param WC_Product $product Variable product.
* @param array $match_attributes Array of attributes we want to try to match.
* @param WC_Product $product Variable product object.
* @param array $match_attributes Array of attributes we want to try to match.
* @return int Matching variation ID or 0.
*/
public function find_matching_product_variation( $product, $match_attributes = array() );
@ -74,18 +79,18 @@ interface WC_Product_Data_Store_Interface {
/**
* Make sure all variations have a sort order set so they can be reordered correctly.
*
* @param int $parent_id
* @param int $parent_id Parent ID.
*/
public function sort_all_product_variations( $parent_id );
/**
* Return a list of related products (using data like categories and IDs).
*
* @param array $cats_array List of categories IDs.
* @param array $tags_array List of tags IDs.
* @param array $cats_array List of categories IDs.
* @param array $tags_array List of tags IDs.
* @param array $exclude_ids Excluded IDs.
* @param int $limit Limit of results.
* @param int $product_id
* @param int $limit Limit of results.
* @param int $product_id Product ID.
* @return array
*/
public function get_related_products( $cats_array, $tags_array, $exclude_ids, $limit, $product_id );
@ -95,9 +100,9 @@ interface WC_Product_Data_Store_Interface {
*
* Uses queries rather than update_post_meta so we can do this in one query (to avoid stock issues).
*
* @param int $product_id_with_stock
* @param int|null $stock_quantity
* @param string $operation set, increase and decrease.
* @param int $product_id_with_stock Product ID.
* @param int|null $stock_quantity Stock quantity to update to.
* @param string $operation Either set, increase or decrease.
*/
public function update_product_stock( $product_id_with_stock, $stock_quantity = null, $operation = 'set' );
@ -106,16 +111,16 @@ interface WC_Product_Data_Store_Interface {
*
* Uses queries rather than update_post_meta so we can do this in one query for performance.
*
* @since 3.0.0 this supports set, increase and decrease.
* @param int $product_id
* @param int|null $quantity
* @param string $operation set, increase and decrease.
* @param int $product_id Product ID.
* @param int|null $quantity Stock quantity to use for update.
* @param string $operation Either set, increase or decrease.
*/
public function update_product_sales( $product_id, $quantity = null, $operation = 'set' );
/**
* Get shipping class ID by slug.
* @param string $slug
*
* @param string $slug Shipping class slug.
* @return int|false
*/
public function get_shipping_class_id_by_slug( $slug );
@ -123,14 +128,15 @@ interface WC_Product_Data_Store_Interface {
/**
* Returns an array of products.
*
* @param array $args @see wc_get_products
* @param array $args @see wc_get_products.
* @return array
*/
public function get_products( $args = array() );
/**
* Get the product type based on product ID.
* @param int $product_id
*
* @param int $product_id Product ID.
* @return bool|string
*/
public function get_product_type( $product_id );

View File

@ -1,4 +1,11 @@
<?php
/**
* Product Variable Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,14 +16,12 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by product variable store classes.
*
* @version 3.0.0
* @category Interface
* @author WooThemes
*/
interface WC_Product_Variable_Data_Store_Interface {
/**
* Does a child have a weight set?
*
* @param WC_Product
* @param WC_Product $product Product object.
* @return boolean
*/
public function child_has_weight( $product );
@ -24,7 +29,7 @@ interface WC_Product_Variable_Data_Store_Interface {
/**
* Does a child have dimensions set?
*
* @param WC_Product
* @param WC_Product $product Product object.
* @return boolean
*/
public function child_has_dimensions( $product );
@ -32,7 +37,7 @@ interface WC_Product_Variable_Data_Store_Interface {
/**
* Is a child in stock?
*
* @param WC_Product
* @param WC_Product $product Product object.
* @return boolean
*/
public function child_is_in_stock( $product );
@ -40,10 +45,9 @@ interface WC_Product_Variable_Data_Store_Interface {
/**
* Syncs all variation names if the parent name is changed.
*
* @param WC_Product $product
* @param string $previous_name
* @param string $new_name
* @since 3.0.0
* @param WC_Product $product Product object.
* @param string $previous_name Previous name.
* @param string $new_name New name.
*/
public function sync_variation_names( &$product, $previous_name = '', $new_name = '' );
@ -51,21 +55,21 @@ interface WC_Product_Variable_Data_Store_Interface {
* Stock managed at the parent level - update children being managed by this product.
* This sync function syncs downwards (from parent to child) when the variable product is saved.
*
* @param WC_Product
* @param WC_Product $product Product object.
*/
public function sync_managed_variation_stock_status( &$product );
/**
* Sync variable product prices with children.
*
* @param WC_Product|int $product
* @param WC_Product|int $product Product object or ID.
*/
public function sync_price( &$product );
/**
* Delete variations of a product.
*
* @param int $product_id
* @param int $product_id Product ID.
* @param bool $force_delete False to trash.
*/
public function delete_variations( $product_id, $force_delete = false );
@ -73,7 +77,7 @@ interface WC_Product_Variable_Data_Store_Interface {
/**
* Untrash variations.
*
* @param int $product_id
* @param int $product_id Product ID.
*/
public function untrash_variations( $product_id );
}

View File

@ -1,4 +1,11 @@
<?php
/**
* Shipping Zone Data Store Interface
*
* @version 3.0.0
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -9,63 +16,69 @@ if ( ! defined( 'ABSPATH' ) ) {
* Functions that must be defined by shipping zone store classes.
*
* @version 3.0.0
* @category Interface
* @author WooCommerce
*/
interface WC_Shipping_Zone_Data_Store_Interface {
/**
* Get a list of shipping methods for a specific zone.
* @param int $zone_id Zone ID
* @param bool $enabled_only True to request enabled methods only.
* @return array Array of objects containing method_id, method_order, instance_id, is_enabled
*
* @param int $zone_id Zone ID.
* @param bool $enabled_only True to request enabled methods only.
* @return array Array of objects containing method_id, method_order, instance_id, is_enabled
*/
public function get_methods( $zone_id, $enabled_only );
/**
* Get count of methods for a zone.
* @param int $zone_id Zone ID
*
* @param int $zone_id Zone ID.
* @return int Method Count
*/
public function get_method_count( $zone_id );
/**
* Add a shipping method to a zone.
* @param int $zone_id Zone ID
* @param string $type Method Type/ID
* @param int $order Method Order
* @return int Instance ID
*
* @param int $zone_id Zone ID.
* @param string $type Method Type/ID.
* @param int $order Method Order ID.
* @return int Instance ID
*/
public function add_method( $zone_id, $type, $order );
/**
* Delete a method instance.
* @param int $instance_id
*
* @param int $instance_id Intance ID.
*/
public function delete_method( $instance_id );
/**
* Get a shipping zone method instance.
* @param int
*
* @param int $instance_id Instance ID.
* @return object
*/
public function get_method( $instance_id );
/**
* Find a matching zone ID for a given package.
* @param object $package
*
* @param object $package Zone package object.
* @return int
*/
public function get_zone_id_from_package( $package );
/**
* Return an ordered list of zones.
*
* @return array An array of objects containing a zone_id, zone_name, and zone_order.
*/
public function get_zones();
/**
* Return a zone ID from an instance ID.
* @param int
*
* @param int $id Instance ID.
* @return int
*/
public function get_zone_id_by_instance_id( $id );

View File

@ -3,9 +3,7 @@
* Webhook Data Store Interface
*
* @version 3.2.0
* @package WooCommerce/Classes/Interfaces
* @category Interface
* @author Automattic
* @package WooCommerce/Interface
*/
if ( ! defined( 'ABSPATH' ) ) {