WP_REST_Request

This commit is contained in:
Mike Jolley 2019-06-06 11:44:59 +01:00
parent 13b18a4211
commit 51d8cefcf8
61 changed files with 431 additions and 431 deletions

View File

@ -118,7 +118,7 @@ abstract class AbstractController extends WP_REST_Controller {
/**
* Bulk create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array Of \WP_Error or WP_REST_Response.
*/
public function batch_items( $request ) {
@ -141,7 +141,7 @@ abstract class AbstractController extends WP_REST_Controller {
if ( ! empty( $items['create'] ) ) {
foreach ( $items['create'] as $item ) {
$_item = new WP_REST_Request( 'POST' );
$_item = new \WP_REST_Request( 'POST' );
// Default parameters.
$defaults = array();
@ -174,7 +174,7 @@ abstract class AbstractController extends WP_REST_Controller {
if ( ! empty( $items['update'] ) ) {
foreach ( $items['update'] as $item ) {
$_item = new WP_REST_Request( 'PUT' );
$_item = new \WP_REST_Request( 'PUT' );
$_item->set_body_params( $item );
$_response = $this->update_item( $_item );
@ -201,7 +201,7 @@ abstract class AbstractController extends WP_REST_Controller {
continue;
}
$_item = new WP_REST_Request( 'DELETE' );
$_item = new \WP_REST_Request( 'DELETE' );
$_item->set_query_params(
array(
'id' => $id,
@ -432,7 +432,7 @@ abstract class AbstractController extends WP_REST_Controller {
* Introduced to support WordPress 4.9.6 changes.
*
* @since 3.5.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array Fields to be included in the response.
*/
public function get_fields_for_response( $request ) {

View File

@ -35,7 +35,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Check if a given request has access to read an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -51,7 +51,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Check if a given request has access to update an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -67,7 +67,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Check if a given request has access to delete an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return bool|\WP_Error
*/
public function delete_item_permissions_check( $request ) {
@ -95,7 +95,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
*
* @since 3.0.0
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return \WP_Error|WP_REST_Response Response object on success, or \WP_Error object on failure.
*/
protected function prepare_object_for_response( $object, $request ) {
@ -107,7 +107,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
* Prepares one object for create or update operation.
*
* @since 3.0.0
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
* @return \WP_Error|WC_Data The prepared item, or \WP_Error object on failure.
*/
@ -119,7 +119,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Get a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -143,7 +143,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
* Save an object data.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @param bool $creating If is creating a new object.
* @return WC_Data|\WP_Error
*/
@ -168,7 +168,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Create a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -197,7 +197,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
* Fires after a single object is created or updated via the REST API.
*
* @param WC_Data $object Inserted object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating object, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, true );
@ -214,7 +214,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Update a single post.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -242,7 +242,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
* Fires after a single object is created or updated via the REST API.
*
* @param WC_Data $object Inserted object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating object, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, false );
@ -256,7 +256,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
* Prepare objects query.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array
*/
protected function prepare_objects_query( $request ) {
@ -298,7 +298,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
* collection request.
*
* @param array $args Key value array of query var to query value.
* @param WP_REST_Request $request The request used.
* @param \WP_REST_Request $request The request used.
*/
$args = apply_filters( "woocommerce_rest_{$this->post_type}_object_query", $args, $request );
@ -335,7 +335,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Get a collection of posts.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -395,7 +395,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
/**
* Delete a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|\WP_Error
*/
public function delete_item( $request ) {
@ -460,7 +460,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
*
* @param WC_Data $object The deleted or trashed object.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( "woocommerce_rest_delete_{$this->post_type}_object", $object, $response, $request );
@ -471,7 +471,7 @@ abstract class AbstractObjectsController extends AbstractPostsController {
* Prepare links for the request.
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array Links for the given post.
*/
protected function prepare_links( $object, $request ) {

View File

@ -40,7 +40,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Check if a given request has access to read items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -54,7 +54,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Check if a given request has access to create an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function create_item_permissions_check( $request ) {
@ -68,7 +68,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Check if a given request has access to read an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -84,7 +84,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Check if a given request has access to update an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -100,7 +100,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Check if a given request has access to delete an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return bool|\WP_Error
*/
public function delete_item_permissions_check( $request ) {
@ -116,7 +116,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return boolean|\WP_Error
*/
@ -131,7 +131,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Get a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -157,7 +157,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Create a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -201,7 +201,7 @@ abstract class AbstractPostsController extends AbstractController {
* Fires after a single item is created or updated via the REST API.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
@ -219,7 +219,7 @@ abstract class AbstractPostsController extends AbstractController {
* Add post meta fields.
*
* @param WP_Post $post Post Object.
* @param WP_REST_Request $request WP_REST_Request Object.
* @param \WP_REST_Request $request \WP_REST_Request Object.
* @return bool|\WP_Error
*/
protected function add_post_meta_fields( $post, $request ) {
@ -238,7 +238,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Update a single post.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -279,7 +279,7 @@ abstract class AbstractPostsController extends AbstractController {
* Fires after a single item is created or updated via the REST API.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
@ -292,7 +292,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Get a collection of posts.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -337,7 +337,7 @@ abstract class AbstractPostsController extends AbstractController {
* collection request.
*
* @param array $args Key value array of query var to query value.
* @param WP_REST_Request $request The request used.
* @param \WP_REST_Request $request The request used.
*/
$args = apply_filters( "woocommerce_rest_{$this->post_type}_query", $args, $request );
$query_args = $this->prepare_items_query( $args, $request );
@ -400,7 +400,7 @@ abstract class AbstractPostsController extends AbstractController {
/**
* Delete a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|\WP_Error
*/
public function delete_item( $request ) {
@ -463,7 +463,7 @@ abstract class AbstractPostsController extends AbstractController {
*
* @param object $post The deleted or trashed item.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( "woocommerce_rest_delete_{$this->post_type}", $post, $response, $request );
@ -474,7 +474,7 @@ abstract class AbstractPostsController extends AbstractController {
* Prepare links for the request.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array Links for the given post.
*/
protected function prepare_links( $post, $request ) {
@ -495,7 +495,7 @@ abstract class AbstractPostsController extends AbstractController {
* prepare for \WP_Query.
*
* @param array $prepared_args Prepared arguments.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array $query_args
*/
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
@ -705,7 +705,7 @@ abstract class AbstractPostsController extends AbstractController {
* Update post meta fields.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return bool|\WP_Error
*/
protected function update_post_meta_fields( $post, $request ) {

View File

@ -46,7 +46,7 @@ abstract class AbstractShippingZonesController extends AbstractController {
/**
* Check whether a given request has permission to read Shipping Zones.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -64,7 +64,7 @@ abstract class AbstractShippingZonesController extends AbstractController {
/**
* Check if a given request has access to create Shipping Zones.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function create_item_permissions_check( $request ) {
@ -82,7 +82,7 @@ abstract class AbstractShippingZonesController extends AbstractController {
/**
* Check whether a given request has permission to edit Shipping Zones.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_items_permissions_check( $request ) {
@ -100,7 +100,7 @@ abstract class AbstractShippingZonesController extends AbstractController {
/**
* Check whether a given request has permission to delete Shipping Zones.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function delete_items_permissions_check( $request ) {

View File

@ -119,7 +119,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Check if a given request has access to read the terms.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -138,7 +138,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Check if a given request has access to create a term.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function create_item_permissions_check( $request ) {
@ -157,7 +157,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Check if a given request has access to read a term.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -176,7 +176,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Check if a given request has access to update a term.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -195,7 +195,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Check if a given request has access to delete a term.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function delete_item_permissions_check( $request ) {
@ -214,7 +214,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return boolean|\WP_Error
*/
public function batch_items_permissions_check( $request ) {
@ -233,7 +233,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Check permissions.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @param string $context Request context.
* @return bool|\WP_Error
*/
@ -262,7 +262,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Get terms associated with a taxonomy.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|\WP_Error
*/
public function get_items( $request ) {
@ -308,7 +308,7 @@ abstract class AbstractTermsContoller extends AbstractController {
*
* @param array $prepared_args Array of arguments to be
* passed to get_terms.
* @param WP_REST_Request $request The current request.
* @param \WP_REST_Request $request The current request.
*/
$prepared_args = apply_filters( "woocommerce_rest_{$taxonomy}_query", $prepared_args, $request );
@ -372,8 +372,8 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Create a single term for a taxonomy.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function create_item( $request ) {
$taxonomy = $this->get_taxonomy( $request );
@ -424,7 +424,7 @@ abstract class AbstractTermsContoller extends AbstractController {
* Fires after a single term is created or updated via the REST API.
*
* @param WP_Term $term Inserted Term object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating term, false when updating.
*/
do_action( "woocommerce_rest_insert_{$taxonomy}", $term, $request, true );
@ -447,8 +447,8 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Get a single term from a taxonomy.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function get_item( $request ) {
$taxonomy = $this->get_taxonomy( $request );
@ -466,8 +466,8 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Update a single term from a taxonomy.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function update_item( $request ) {
$taxonomy = $this->get_taxonomy( $request );
@ -513,7 +513,7 @@ abstract class AbstractTermsContoller extends AbstractController {
* Fires after a single term is created or updated via the REST API.
*
* @param WP_Term $term Inserted Term object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating term, false when updating.
*/
do_action( "woocommerce_rest_insert_{$taxonomy}", $term, $request, false );
@ -526,7 +526,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Delete a single term from a taxonomy.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|\WP_Error
*/
public function delete_item( $request ) {
@ -560,7 +560,7 @@ abstract class AbstractTermsContoller extends AbstractController {
*
* @param WP_Term $term The deleted term.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( "woocommerce_rest_delete_{$taxonomy}", $term, $response, $request );
@ -571,7 +571,7 @@ abstract class AbstractTermsContoller extends AbstractController {
* Prepare links for the request.
*
* @param object $term Term object.
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array Links for the given term.
*/
protected function prepare_links( $term, $request ) {
@ -606,7 +606,7 @@ abstract class AbstractTermsContoller extends AbstractController {
* Update term meta fields.
*
* @param WP_Term $term Term object.
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return bool|\WP_Error
*/
protected function update_term_meta_fields( $term, $request ) {
@ -622,7 +622,7 @@ abstract class AbstractTermsContoller extends AbstractController {
* are instead treated as a full query.
*
* @param array $prepared_args Arguments for `get_terms()`.
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array List of term objects. (Total count in `$this->total_terms`).
*/
protected function get_terms_for_product( $prepared_args, $request ) {
@ -784,7 +784,7 @@ abstract class AbstractTermsContoller extends AbstractController {
/**
* Get taxonomy.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return int|\WP_Error
*/
protected function get_taxonomy( $request ) {

View File

@ -203,7 +203,7 @@ class Coupons extends AbstractPostsController {
*
* @since 3.0.0
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_object_for_response( $object, $request ) {
@ -222,7 +222,7 @@ class Coupons extends AbstractPostsController {
*
* @param WP_REST_Response $response The response object.
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}_object", $response, $object, $request );
}
@ -231,7 +231,7 @@ class Coupons extends AbstractPostsController {
* Prepare objects query.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array
*/
protected function prepare_objects_query( $request ) {
@ -256,7 +256,7 @@ class Coupons extends AbstractPostsController {
/**
* Prepare a single coupon for create or update.
*
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
* @return \WP_Error|WC_Data
*/
@ -314,7 +314,7 @@ class Coupons extends AbstractPostsController {
* refers to the object type slug.
*
* @param WC_Data $coupon Object object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $coupon, $request, $creating );
@ -550,7 +550,7 @@ class Coupons extends AbstractPostsController {
* Query args.
*
* @param array $args Query args.
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array
*/
public function query_args( $args, $request ) {
@ -566,7 +566,7 @@ class Coupons extends AbstractPostsController {
* Prepare a single coupon output for response.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $data
*/
public function prepare_item_for_response( $post, $request ) {
@ -636,7 +636,7 @@ class Coupons extends AbstractPostsController {
*
* @param WP_REST_Response $response The response object.
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
}
@ -654,7 +654,7 @@ class Coupons extends AbstractPostsController {
/**
* Prepare a single coupon for create or update.
*
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return \WP_Error|stdClass $data Post object.
*/
protected function prepare_item_for_database( $request ) {
@ -717,7 +717,7 @@ class Coupons extends AbstractPostsController {
* prepared for insertion.
*
* @param WC_Coupon $coupon The coupon object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $coupon, $request );
}
@ -725,7 +725,7 @@ class Coupons extends AbstractPostsController {
/**
* Create a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -748,7 +748,7 @@ class Coupons extends AbstractPostsController {
* Fires after a single item is created or updated via the REST API.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
@ -764,7 +764,7 @@ class Coupons extends AbstractPostsController {
/**
* Update a single coupon.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -787,7 +787,7 @@ class Coupons extends AbstractPostsController {
* Fires after a single item is created or updated via the REST API.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
@ -803,7 +803,7 @@ class Coupons extends AbstractPostsController {
/**
* Get a collection of posts and add the code search option to \WP_Query.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {

View File

@ -51,7 +51,7 @@ class CustomerDownloads extends AbstractController {
/**
* Check whether a given request has permission to read customers.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -71,7 +71,7 @@ class CustomerDownloads extends AbstractController {
/**
* Get all customer downloads.
*
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return array
*/
public function get_items( $request ) {
@ -91,7 +91,7 @@ class CustomerDownloads extends AbstractController {
* Prepare a single download output for response.
*
* @param stdClass $download Download object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $download, $request ) {
@ -123,7 +123,7 @@ class CustomerDownloads extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param stdClass $download Download object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_customer_download', $response, $download, $request );
}
@ -132,7 +132,7 @@ class CustomerDownloads extends AbstractController {
* Prepare links for the request.
*
* @param stdClass $download Download object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array Links for the given customer download.
*/
protected function prepare_links( $download, $request ) {

View File

@ -131,7 +131,7 @@ class Customers extends AbstractController {
/**
* Check whether a given request has permission to read customers.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -145,7 +145,7 @@ class Customers extends AbstractController {
/**
* Check if a given request has access create customers.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -160,7 +160,7 @@ class Customers extends AbstractController {
/**
* Check if a given request has access to read a customer.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -176,7 +176,7 @@ class Customers extends AbstractController {
/**
* Check if a given request has access update a customer.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -193,7 +193,7 @@ class Customers extends AbstractController {
/**
* Check if a given request has access delete a customer.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -210,7 +210,7 @@ class Customers extends AbstractController {
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -264,7 +264,7 @@ class Customers extends AbstractController {
/**
* Get all customers.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -308,7 +308,7 @@ class Customers extends AbstractController {
* @see https://developer.wordpress.org/reference/classes/\ WP_User_Query/
*
* @param array $prepared_args Array of arguments for \ WP_User_Query.
* @param WP_REST_Request $request The current request.
* @param \WP_REST_Request $request The current request.
*/
$prepared_args = apply_filters( 'woocommerce_rest_customer_query', $prepared_args, $request );
@ -362,7 +362,7 @@ class Customers extends AbstractController {
* Create a single customer.
*
* @throws WC_REST_Exception On invalid params.
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -396,7 +396,7 @@ class Customers extends AbstractController {
* Fires after a customer is created or updated via the REST API.
*
* @param WP_User $user_data Data used to create the customer.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating customer, false when updating customer.
*/
do_action( 'woocommerce_rest_insert_customer', $user_data, $request, true );
@ -416,7 +416,7 @@ class Customers extends AbstractController {
/**
* Get a single customer.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -437,7 +437,7 @@ class Customers extends AbstractController {
* Update a single user.
*
* @throws WC_REST_Exception On invalid params.
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -481,7 +481,7 @@ class Customers extends AbstractController {
* Fires after a customer is created or updated via the REST API.
*
* @param WP_User $customer Data used to create the customer.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating customer, false when updating customer.
*/
do_action( 'woocommerce_rest_insert_customer', $user_data, $request, false );
@ -498,7 +498,7 @@ class Customers extends AbstractController {
/**
* Delete a single customer.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function delete_item( $request ) {
@ -545,7 +545,7 @@ class Customers extends AbstractController {
*
* @param WP_User $user_data User data.
* @param WP_REST_Response $response The response returned from the API.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( 'woocommerce_rest_delete_customer', $user_data, $response, $request );
@ -556,7 +556,7 @@ class Customers extends AbstractController {
* Prepare a single customer output for response.
*
* @param WP_User $user_data User object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $user_data, $request ) {
@ -573,7 +573,7 @@ class Customers extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param WP_User $user_data User object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_customer', $response, $user_data, $request );
}
@ -582,7 +582,7 @@ class Customers extends AbstractController {
* Update customer meta fields.
*
* @param WC_Customer $customer Customer being updated.
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
*/
protected function update_customer_meta_fields( $customer, $request ) {
$schema = $this->get_item_schema();

View File

@ -46,7 +46,7 @@ class Data extends AbstractController {
/**
* Check whether a given request has permission to read site data.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -60,7 +60,7 @@ class Data extends AbstractController {
/**
* Check whether a given request has permission to read site settings.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -75,7 +75,7 @@ class Data extends AbstractController {
* Return the list of data resources.
*
* @since 3.5.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -111,7 +111,7 @@ class Data extends AbstractController {
* Prepare a data resource object for serialization.
*
* @param stdClass $resource Resource data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $resource, $request ) {

View File

@ -68,7 +68,7 @@ class Continents extends DataController {
*
* @since 3.5.0
* @param string $continent_code Continent code.
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|mixed Response data, ready for insertion into collection data.
*/
public function get_continent( $continent_code = false, $request ) {
@ -154,7 +154,7 @@ class Continents extends DataController {
* Return the list of states for all continents.
*
* @since 3.5.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -174,7 +174,7 @@ class Continents extends DataController {
* Return the list of locations for a given continent.
*
* @since 3.5.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -190,7 +190,7 @@ class Continents extends DataController {
*
* @since 3.5.0
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -207,7 +207,7 @@ class Continents extends DataController {
*
* @param WP_REST_Response $response The response object.
* @param array $item The original list of continent(s), countries, and states.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_data_continent', $response, $item, $request );
}

View File

@ -67,7 +67,7 @@ class Countries extends DataController {
* Get a list of countries and states.
*
* @param string $country_code Country code.
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|mixed Response data, ready for insertion into collection data.
*/
public function get_country( $country_code = false, $request ) {
@ -101,7 +101,7 @@ class Countries extends DataController {
* Return the list of states for all countries.
*
* @since 3.5.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -121,7 +121,7 @@ class Countries extends DataController {
* Return the list of states for a given country.
*
* @since 3.5.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -137,7 +137,7 @@ class Countries extends DataController {
*
* @since 3.5.0
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -154,7 +154,7 @@ class Countries extends DataController {
*
* @param WP_REST_Response $response The response object.
* @param array $data The original country's states list.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_data_country', $response, $item, $request );
}

View File

@ -77,7 +77,7 @@ class Currencies extends DataController {
* Get currency information.
*
* @param string $code Currency code.
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|mixed Response data, ready for insertion into collection data.
*/
public function get_currency( $code = false, $request ) {
@ -100,7 +100,7 @@ class Currencies extends DataController {
/**
* Return the list of currencies.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -117,7 +117,7 @@ class Currencies extends DataController {
/**
* Return information for a specific currency.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -131,7 +131,7 @@ class Currencies extends DataController {
/**
* Return information for the current site currency.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_current_item( $request ) {
@ -143,7 +143,7 @@ class Currencies extends DataController {
* Prepare the data object for response.
*
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -158,7 +158,7 @@ class Currencies extends DataController {
*
* @param WP_REST_Response $response The response object.
* @param array $item Currency data.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_data_currency', $response, $item, $request );
}

View File

@ -49,7 +49,7 @@ class DownloadIPs extends DataController {
* Return the download IPs matching the passed parameters.
*
* @since 3.5.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -85,7 +85,7 @@ class DownloadIPs extends DataController {
*
* @since 3.5.0
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -100,7 +100,7 @@ class DownloadIPs extends DataController {
*
* @param WP_REST_Response $response The response object.
* @param array $item The original item.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_data_download_ip', $response, $item, $request );
}

View File

@ -344,7 +344,7 @@ class Leaderboards extends AbstractController {
/**
* Return all leaderboards.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -365,7 +365,7 @@ class Leaderboards extends AbstractController {
/**
* Returns a list of allowed leaderboards.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_allowed_items( $request ) {
@ -399,7 +399,7 @@ class Leaderboards extends AbstractController {
* Prepare the data object for response.
*
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -412,7 +412,7 @@ class Leaderboards extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param array $item The original item.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_leaderboard', $response, $item, $request );
}

View File

@ -82,7 +82,7 @@ class NetworkOrders extends Orders {
/**
* Does a permissions check for the proper requested blog
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool $permission
*/
@ -102,7 +102,7 @@ class NetworkOrders extends Orders {
/**
* Get a collection of orders from the requested blog id
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return WP_REST_Response
*/

View File

@ -123,7 +123,7 @@ class Levels extends WC_REST_Data_Controller {
/**
* Return all level items and child tasks.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -147,7 +147,7 @@ class Levels extends WC_REST_Data_Controller {
* Prepare the data object for response.
*
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -162,7 +162,7 @@ class Levels extends WC_REST_Data_Controller {
*
* @param WP_REST_Response $response The response object.
* @param array $item The original item.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_onboarding_level', $response, $item, $request );
}

View File

@ -81,7 +81,7 @@ class Plugins extends WC_REST_Data_Controller {
/**
* Check if a given request has access to manage plugins.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -107,7 +107,7 @@ class Plugins extends WC_REST_Data_Controller {
/**
* Installs the requested plugin.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array Plugin Status
*/
public function install_plugin( $request ) {
@ -168,7 +168,7 @@ class Plugins extends WC_REST_Data_Controller {
/**
* Activate the requested plugin.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array Plugin Status
*/
public function activate_plugin( $request ) {

View File

@ -69,7 +69,7 @@ class Profile extends WC_REST_Data_Controller {
/**
* Check whether a given request has permission to read onboarding profile data.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -83,7 +83,7 @@ class Profile extends WC_REST_Data_Controller {
/**
* Check whether a given request has permission to edit onboarding profile data.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_items_permissions_check( $request ) {
@ -97,7 +97,7 @@ class Profile extends WC_REST_Data_Controller {
/**
* Return all onboarding profile data.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -118,7 +118,7 @@ class Profile extends WC_REST_Data_Controller {
/**
* Update onboarding profile data.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function update_items( $request ) {
@ -173,7 +173,7 @@ class Profile extends WC_REST_Data_Controller {
* Prepare the data object for response.
*
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -186,7 +186,7 @@ class Profile extends WC_REST_Data_Controller {
*
* @param WP_REST_Response $response The response object.
* @param array $item The original item.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_onboarding_profile', $response, $item, $request );
}

View File

@ -100,7 +100,7 @@ class OrderNotes extends AbstractController {
/**
* Check whether a given request has permission to read order notes.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -114,7 +114,7 @@ class OrderNotes extends AbstractController {
/**
* Check if a given request has access create order notes.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -129,7 +129,7 @@ class OrderNotes extends AbstractController {
/**
* Check if a given request has access to read a order note.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -145,7 +145,7 @@ class OrderNotes extends AbstractController {
/**
* Check if a given request has access delete a order note.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -162,7 +162,7 @@ class OrderNotes extends AbstractController {
/**
* Get order notes from an order.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
*
* @return array|\WP_Error
*/
@ -216,7 +216,7 @@ class OrderNotes extends AbstractController {
/**
* Create a single order note.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -245,7 +245,7 @@ class OrderNotes extends AbstractController {
* Fires after a order note is created or updated via the REST API.
*
* @param WP_Comment $note New order note object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( 'woocommerce_rest_insert_order_note', $note, $request, true );
@ -262,7 +262,7 @@ class OrderNotes extends AbstractController {
/**
* Get a single order note.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -288,7 +288,7 @@ class OrderNotes extends AbstractController {
/**
* Delete a single order note.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|\WP_Error
*/
public function delete_item( $request ) {
@ -326,7 +326,7 @@ class OrderNotes extends AbstractController {
*
* @param WP_Comment $note The deleted or trashed order note.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( 'woocommerce_rest_delete_order_note', $note, $response, $request );
@ -337,7 +337,7 @@ class OrderNotes extends AbstractController {
* Prepare a single order note output for response.
*
* @param WP_Comment $note Order note object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $note, $request ) {
@ -364,7 +364,7 @@ class OrderNotes extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param WP_Comment $note Order note object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_order_note', $response, $note, $request );
}

View File

@ -173,7 +173,7 @@ class OrderRefunds extends Orders {
* @since 3.0.0
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*
* @return \WP_Error|WP_REST_Response
*/
@ -208,7 +208,7 @@ class OrderRefunds extends Orders {
*
* @param WP_REST_Response $response The response object.
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}_object", $response, $object, $request );
}
@ -217,7 +217,7 @@ class OrderRefunds extends Orders {
* Prepare a single order refund output for response.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*
* @return \WP_Error|WP_REST_Response
*/
@ -326,7 +326,7 @@ class OrderRefunds extends Orders {
*
* @param WP_REST_Response $response The response object.
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
}
@ -335,7 +335,7 @@ class OrderRefunds extends Orders {
* Prepare links for the request.
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array Links for the given post.
*/
protected function prepare_links( $object, $request ) {
@ -359,7 +359,7 @@ class OrderRefunds extends Orders {
* Prepare objects query.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array
*/
protected function prepare_objects_query( $request ) {
@ -374,7 +374,7 @@ class OrderRefunds extends Orders {
/**
* Create a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -419,7 +419,7 @@ class OrderRefunds extends Orders {
* Fires after a single item is created or updated via the REST API.
*
* @param WP_Post $post Post object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
@ -437,7 +437,7 @@ class OrderRefunds extends Orders {
* Prepares one object for create or update operation.
*
* @since 3.0.0
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
* @return \WP_Error|WC_Data The prepared item, or \WP_Error object on failure.
*/
@ -486,7 +486,7 @@ class OrderRefunds extends Orders {
* refers to the object type slug.
*
* @param WC_Data $coupon Object object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $refund, $request, $creating );
@ -496,7 +496,7 @@ class OrderRefunds extends Orders {
* Save an object data.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @param bool $creating If is creating a new object.
* @return WC_Data|\WP_Error
*/

View File

@ -284,7 +284,7 @@ class Orders extends AbstractObjectsController {
*
* @since 3.0.0
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_object_for_response( $object, $request ) {
@ -305,7 +305,7 @@ class Orders extends AbstractObjectsController {
*
* @param WP_REST_Response $response The response object.
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}_object", $response, $object, $request );
}
@ -314,7 +314,7 @@ class Orders extends AbstractObjectsController {
* Prepare links for the request.
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array Links for the given post.
*/
protected function prepare_links( $object, $request ) {
@ -346,7 +346,7 @@ class Orders extends AbstractObjectsController {
* Prepare objects query.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array
*/
protected function prepare_objects_query( $request ) {
@ -412,7 +412,7 @@ class Orders extends AbstractObjectsController {
* Prepare a single order for create or update.
*
* @throws WC_REST_Exception When fails to set any item.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
* @return \WP_Error|WC_Data
*/
@ -474,7 +474,7 @@ class Orders extends AbstractObjectsController {
* refers to the object type slug.
*
* @param WC_Data $order Object object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $order, $request, $creating );
@ -485,7 +485,7 @@ class Orders extends AbstractObjectsController {
*
* @since 3.0.0
* @throws WC_REST_Exception But all errors are validated before returning any data.
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @param bool $creating If is creating a new object.
* @return WC_Data|\WP_Error
*/
@ -1696,7 +1696,7 @@ class Orders extends AbstractObjectsController {
* Calculate coupons.
*
* @throws WC_REST_Exception When fails to set any item.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param WC_Order $order Order data.
* @return bool
*/

View File

@ -72,7 +72,7 @@ class PaymentGateways extends AbstractController {
/**
* Check whether a given request has permission to view payment gateways.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -85,7 +85,7 @@ class PaymentGateways extends AbstractController {
/**
* Check if a given request has access to read a payment gateway.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -98,7 +98,7 @@ class PaymentGateways extends AbstractController {
/**
* Check whether a given request has permission to edit payment gateways.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_items_permissions_check( $request ) {
@ -111,7 +111,7 @@ class PaymentGateways extends AbstractController {
/**
* Get payment gateways.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -129,7 +129,7 @@ class PaymentGateways extends AbstractController {
/**
* Get a single payment gateway.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function get_item( $request ) {
@ -146,7 +146,7 @@ class PaymentGateways extends AbstractController {
/**
* Update A Single Payment Method.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function update_item( $request ) {
@ -220,7 +220,7 @@ class PaymentGateways extends AbstractController {
/**
* Get a gateway based on the current request object.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|null
*/
public function get_gateway( $request ) {
@ -240,7 +240,7 @@ class PaymentGateways extends AbstractController {
* Prepare a payment gateway for response.
*
* @param WC_Payment_Gateway $gateway Payment gateway object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $gateway, $request ) {
@ -269,7 +269,7 @@ class PaymentGateways extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param WC_Payment_Gateway $gateway Payment gateway object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_payment_gateway', $response, $gateway, $request );
}
@ -317,7 +317,7 @@ class PaymentGateways extends AbstractController {
* Prepare links for the request.
*
* @param WC_Payment_Gateway $gateway Payment gateway object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array
*/
protected function prepare_links( $gateway, $request ) {

View File

@ -131,7 +131,7 @@ class ProductAttributeTerms extends AbstractTermsContoller {
* Prepare a single product attribute term output for response.
*
* @param WP_Term $item Term object.
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {
@ -162,7 +162,7 @@ class ProductAttributeTerms extends AbstractTermsContoller {
*
* @param WP_REST_Response $response The response object.
* @param object $item The original term object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request );
}
@ -171,7 +171,7 @@ class ProductAttributeTerms extends AbstractTermsContoller {
* Update term meta fields.
*
* @param WP_Term $term Term object.
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return bool|\WP_Error
*/
protected function update_term_meta_fields( $term, $request ) {

View File

@ -121,7 +121,7 @@ class ProductAttributes extends AbstractController {
/**
* Check if a given request has access to read the attributes.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -135,7 +135,7 @@ class ProductAttributes extends AbstractController {
/**
* Check if a given request has access to create a attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function create_item_permissions_check( $request ) {
@ -149,7 +149,7 @@ class ProductAttributes extends AbstractController {
/**
* Check if a given request has access to read a attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -167,7 +167,7 @@ class ProductAttributes extends AbstractController {
/**
* Check if a given request has access to update a attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -185,7 +185,7 @@ class ProductAttributes extends AbstractController {
/**
* Check if a given request has access to delete a attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function delete_item_permissions_check( $request ) {
@ -203,7 +203,7 @@ class ProductAttributes extends AbstractController {
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -218,7 +218,7 @@ class ProductAttributes extends AbstractController {
/**
* Get all attributes.
*
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return array
*/
public function get_items( $request ) {
@ -236,8 +236,8 @@ class ProductAttributes extends AbstractController {
/**
* Create a single attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function create_item( $request ) {
global $wpdb;
@ -269,7 +269,7 @@ class ProductAttributes extends AbstractController {
* Fires after a single product attribute is created or updated via the REST API.
*
* @param stdObject $attribute Inserted attribute object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating attribute, false when updating.
*/
do_action( 'woocommerce_rest_insert_product_attribute', $attribute, $request, true );
@ -286,8 +286,8 @@ class ProductAttributes extends AbstractController {
/**
* Get a single attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function get_item( $request ) {
$attribute = $this->get_attribute( (int) $request['id'] );
@ -304,8 +304,8 @@ class ProductAttributes extends AbstractController {
/**
* Update a single term from a taxonomy.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function update_item( $request ) {
global $wpdb;
@ -339,7 +339,7 @@ class ProductAttributes extends AbstractController {
* Fires after a single product attribute is created or updated via the REST API.
*
* @param stdObject $attribute Inserted attribute object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating attribute, false when updating.
*/
do_action( 'woocommerce_rest_insert_product_attribute', $attribute, $request, false );
@ -353,7 +353,7 @@ class ProductAttributes extends AbstractController {
/**
* Delete a single attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|\WP_Error
*/
public function delete_item( $request ) {
@ -384,7 +384,7 @@ class ProductAttributes extends AbstractController {
*
* @param stdObject $attribute The deleted attribute.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( 'woocommerce_rest_delete_product_attribute', $attribute, $response, $request );
@ -395,7 +395,7 @@ class ProductAttributes extends AbstractController {
* Prepare a single product attribute output for response.
*
* @param obj $item Term object.
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {
@ -423,7 +423,7 @@ class ProductAttributes extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param object $item The original attribute object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_product_attribute', $response, $item, $request );
}
@ -522,7 +522,7 @@ class ProductAttributes extends AbstractController {
/**
* Get attribute name.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return string
*/
protected function get_taxonomy( $request ) {

View File

@ -34,7 +34,7 @@ class ProductCategories extends AbstractTermsContoller {
* Prepare a single product category output for response.
*
* @param WP_Term $item Term object.
* @param WP_REST_Request $request Request instance.
* @param \WP_REST_Request $request Request instance.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $item, $request ) {
@ -88,7 +88,7 @@ class ProductCategories extends AbstractTermsContoller {
*
* @param WP_REST_Response $response The response object.
* @param object $item The original term object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request );
}
@ -97,7 +97,7 @@ class ProductCategories extends AbstractTermsContoller {
* Update term meta fields.
*
* @param WP_Term $term Term object.
* @param WP_REST_Request $request Request instance.
* @param \WP_REST_Request $request Request instance.
* @return bool|\WP_Error
*
* @since 3.5.5

View File

@ -129,7 +129,7 @@ class ProductReviews extends AbstractController {
/**
* Check whether a given request has permission to read webhook deliveries.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -143,7 +143,7 @@ class ProductReviews extends AbstractController {
/**
* Check if a given request has access to read a product review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -160,7 +160,7 @@ class ProductReviews extends AbstractController {
/**
* Check if a given request has access to create a new product review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function create_item_permissions_check( $request ) {
@ -174,7 +174,7 @@ class ProductReviews extends AbstractController {
/**
* Check if a given request has access to update a product review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -191,7 +191,7 @@ class ProductReviews extends AbstractController {
/**
* Check if a given request has access to delete a product review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function delete_item_permissions_check( $request ) {
@ -208,7 +208,7 @@ class ProductReviews extends AbstractController {
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return boolean|\WP_Error
*/
public function batch_items_permissions_check( $request ) {
@ -222,7 +222,7 @@ class ProductReviews extends AbstractController {
/**
* Get all reviews.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -299,7 +299,7 @@ class ProductReviews extends AbstractController {
* @since 3.5.0
* @link https://developer.wordpress.org/reference/classes/wp_comment_query/
* @param array $prepared_args Array of arguments for WP_Comment_Query.
* @param WP_REST_Request $request The current request.
* @param \WP_REST_Request $request The current request.
*/
$prepared_args = apply_filters( 'woocommerce_rest_product_review_query', $prepared_args, $request );
@ -364,7 +364,7 @@ class ProductReviews extends AbstractController {
/**
* Create a single review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -445,7 +445,7 @@ class ProductReviews extends AbstractController {
*
* @since 3.5.0
* @param array|\WP_Error $prepared_review The prepared review data for wp_insert_comment().
* @param WP_REST_Request $request Request used to insert the review.
* @param \WP_REST_Request $request Request used to insert the review.
*/
$prepared_review = apply_filters( 'woocommerce_rest_pre_insert_product_review', $prepared_review, $request );
if ( is_wp_error( $prepared_review ) ) {
@ -470,7 +470,7 @@ class ProductReviews extends AbstractController {
* Fires after a comment is created or updated via the REST API.
*
* @param WP_Comment $review Inserted or updated comment object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating True when creating a comment, false when updating.
*/
do_action( 'woocommerce_rest_insert_product_review', $review, $request, true );
@ -495,7 +495,7 @@ class ProductReviews extends AbstractController {
/**
* Get a single product review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -513,7 +513,7 @@ class ProductReviews extends AbstractController {
/**
* Updates a review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response Response object on success, or error object on failure.
*/
public function update_item( $request ) {
@ -599,7 +599,7 @@ class ProductReviews extends AbstractController {
/**
* Deletes a review.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response Response object on success, or error object on failure.
*/
public function delete_item( $request ) {
@ -658,7 +658,7 @@ class ProductReviews extends AbstractController {
*
* @param WP_Comment $review The deleted review data.
* @param WP_REST_Response $response The response returned from the API.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( 'woocommerce_rest_delete_review', $review, $response, $request );
@ -669,7 +669,7 @@ class ProductReviews extends AbstractController {
* Prepare a single product review output for response.
*
* @param WP_Comment $review Product review object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $review, $request ) {
@ -724,7 +724,7 @@ class ProductReviews extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param WP_Comment $review Product review object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_product_review', $response, $review, $request );
}
@ -732,7 +732,7 @@ class ProductReviews extends AbstractController {
/**
* Prepare a single product review to be inserted into the database.
*
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array|\WP_Error $prepared_review
*/
protected function prepare_item_for_database( $request ) {
@ -777,7 +777,7 @@ class ProductReviews extends AbstractController {
*
* @since 3.5.0
* @param array $prepared_review The prepared review data for `wp_insert_comment`.
* @param WP_REST_Request $request The current request.
* @param \WP_REST_Request $request The current request.
*/
return apply_filters( 'woocommerce_rest_preprocess_product_review', $prepared_review, $request );
}

View File

@ -34,7 +34,7 @@ class ProductShippingClasses extends AbstractTermsContoller {
* Prepare a single product shipping class output for response.
*
* @param obj $item Term object.
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {
@ -61,7 +61,7 @@ class ProductShippingClasses extends AbstractTermsContoller {
*
* @param WP_REST_Response $response The response object.
* @param object $item The original term object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request );
}

View File

@ -34,7 +34,7 @@ class ProductTags extends AbstractTermsContoller {
* Prepare a single product tag output for response.
*
* @param obj $item Term object.
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {
@ -61,7 +61,7 @@ class ProductTags extends AbstractTermsContoller {
*
* @param WP_REST_Response $response The response object.
* @param object $item The original term object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request );
}

View File

@ -148,7 +148,7 @@ class ProductVariations extends Products {
/**
* Check if a given request has access to update an item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -170,7 +170,7 @@ class ProductVariations extends Products {
* Prepare a single variation output for response.
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_object_for_response( $object, $request ) {
@ -237,7 +237,7 @@ class ProductVariations extends Products {
*
* @param WP_REST_Response $response The response object.
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}_object", $response, $object, $request );
}
@ -330,7 +330,7 @@ class ProductVariations extends Products {
* Prepare objects query.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array
*/
protected function prepare_objects_query( $request ) {
@ -415,7 +415,7 @@ class ProductVariations extends Products {
/**
* Prepare a single variation for create or update.
*
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
* @return \WP_Error|WC_Data
*/
@ -615,7 +615,7 @@ class ProductVariations extends Products {
* refers to the object type slug.
*
* @param WC_Data $variation Object object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $variation, $request, $creating );
@ -634,7 +634,7 @@ class ProductVariations extends Products {
/**
* Delete a variation.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error|WP_REST_Response
*/
@ -725,7 +725,7 @@ class ProductVariations extends Products {
*
* @param WC_Data $object The deleted or trashed object.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( "woocommerce_rest_delete_{$this->post_type}_object", $object, $response, $request );
@ -736,7 +736,7 @@ class ProductVariations extends Products {
* Bulk create, update and delete items.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array Of \WP_Error or WP_REST_Response.
*/
public function batch_items( $request ) {
@ -759,7 +759,7 @@ class ProductVariations extends Products {
}
}
$request = new WP_REST_Request( $request->get_method() );
$request = new \WP_REST_Request( $request->get_method() );
$request->set_body_params( $body_params );
return parent::batch_items( $request );
@ -769,7 +769,7 @@ class ProductVariations extends Products {
* Prepare links for the request.
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array Links for the given post.
*/
protected function prepare_links( $object, $request ) {
@ -1200,7 +1200,7 @@ class ProductVariations extends Products {
/**
* Get a collection of posts and add the post title filter option to \WP_Query.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {

View File

@ -143,7 +143,7 @@ class Products extends AbstractObjectsController {
* Prepare a single product output for response.
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*
* @since 3.0.0
* @return WP_REST_Response
@ -175,7 +175,7 @@ class Products extends AbstractObjectsController {
*
* @param WP_REST_Response $response The response object.
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}_object", $response, $object, $request );
}
@ -183,7 +183,7 @@ class Products extends AbstractObjectsController {
/**
* Prepare a single product for create or update.
*
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
* @return \WP_Error|WC_Data
*/
@ -584,7 +584,7 @@ class Products extends AbstractObjectsController {
* refers to the object type slug.
*
* @param WC_Data $product Object object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $product, $request, $creating );
@ -593,7 +593,7 @@ class Products extends AbstractObjectsController {
/**
* Get a collection of posts and add the post title filter option to \WP_Query.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -689,7 +689,7 @@ class Products extends AbstractObjectsController {
* Make extra product orderby features supported by WooCommerce available to the WC API.
* This includes 'price', 'popularity', and 'rating'.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array
*/
protected function prepare_objects_query( $request ) {
@ -1171,7 +1171,7 @@ class Products extends AbstractObjectsController {
* Prepare links for the request.
*
* @param WC_Data $object Object data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*
* @return array Links for the given post.
*/
@ -1365,7 +1365,7 @@ class Products extends AbstractObjectsController {
* Save default attributes.
*
* @param WC_Product $product Product instance.
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
*
* @since 3.0.0
* @return WC_Product
@ -1435,7 +1435,7 @@ class Products extends AbstractObjectsController {
/**
* Delete a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return WP_REST_Response|\WP_Error
*/
@ -1565,7 +1565,7 @@ class Products extends AbstractObjectsController {
*
* @param WC_Data $object The deleted or trashed object.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( "woocommerce_rest_delete_{$this->post_type}_object", $object, $response, $request );

View File

@ -45,7 +45,7 @@ class Reports extends AbstractController {
/**
* Check whether a given request has permission to read reports.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -60,7 +60,7 @@ class Reports extends AbstractController {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -189,7 +189,7 @@ class Reports extends AbstractController {
* Prepare a report object for serialization.
*
* @param stdClass $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -226,7 +226,7 @@ class Reports extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report', $response, $report, $request );
}

View File

@ -51,7 +51,7 @@ class Categories extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -102,7 +102,7 @@ class Categories extends Reports {
* Prepare a report object for serialization.
*
* @param stdClass $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -123,7 +123,7 @@ class Categories extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_categories', $response, $report, $request );
}

View File

@ -49,7 +49,7 @@ class CouponStats extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -99,7 +99,7 @@ class CouponStats extends Reports {
* Prepare a report object for serialization.
*
* @param stdClass $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -119,7 +119,7 @@ class CouponStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_coupons_stats', $response, $report, $request );
}

View File

@ -47,7 +47,7 @@ class Coupons extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -90,7 +90,7 @@ class Coupons extends Reports {
* Prepare a report object for serialization.
*
* @param stdClass $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -111,7 +111,7 @@ class Coupons extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_coupons', $response, $report, $request );
}

View File

@ -69,7 +69,7 @@ class CustomerStats extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -87,7 +87,7 @@ class CustomerStats extends Reports {
* Prepare a report object for serialization.
*
* @param Array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -107,7 +107,7 @@ class CustomerStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_customers_stats', $response, $report, $request );
}

View File

@ -76,7 +76,7 @@ class Customers extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -119,7 +119,7 @@ class Customers extends Reports {
* Prepare a report object for serialization.
*
* @param array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -141,7 +141,7 @@ class Customers extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_customers', $response, $report, $request );
}

View File

@ -56,7 +56,7 @@ class DownloadStats extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -102,7 +102,7 @@ class DownloadStats extends Reports {
* Prepare a report object for serialization.
*
* @param Array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -122,7 +122,7 @@ class DownloadStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_downloads_stats', $response, $report, $request );
}

View File

@ -28,7 +28,7 @@ class Downloads extends Reports {
/**
* Get items.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -79,7 +79,7 @@ class Downloads extends Reports {
* Prepare a report object for serialization.
*
* @param Array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -114,7 +114,7 @@ class Downloads extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_downloads', $response, $report, $request );
}

View File

@ -96,7 +96,7 @@ class Import extends Reports {
/**
* Makes sure the current user has access to WRITE the settings APIs.
*
* @param WP_REST_Request $request Full data about the request.
* @param \WP_REST_Request $request Full data about the request.
* @return \WP_Error|bool
*/
public function import_permissions_check( $request ) {
@ -109,7 +109,7 @@ class Import extends Reports {
/**
* Import data based on user request params.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function import_items( $request ) {
@ -137,7 +137,7 @@ class Import extends Reports {
/**
* Prepare request object as query args.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array
*/
protected function prepare_objects_query( $request ) {
@ -152,7 +152,7 @@ class Import extends Reports {
* Prepare the data object for response.
*
* @param object $item Data object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -165,7 +165,7 @@ class Import extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param array $item The original item.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_reports_import', $response, $item, $request );
}
@ -226,7 +226,7 @@ class Import extends Reports {
/**
* Cancel all queued import actions.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function cancel_import( $request ) {
@ -246,7 +246,7 @@ class Import extends Reports {
/**
* Delete all imported items.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function delete_imported_items( $request ) {
@ -273,7 +273,7 @@ class Import extends Reports {
/**
* Get the status of the current import.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_import_status( $request ) {
@ -295,7 +295,7 @@ class Import extends Reports {
/**
* Get the total orders and customers based on user supplied params.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_import_totals( $request ) {

View File

@ -59,7 +59,7 @@ class OrderStats extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -109,7 +109,7 @@ class OrderStats extends Reports {
* Prepare a report object for serialization.
*
* @param Array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -129,7 +129,7 @@ class OrderStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_orders_stats', $response, $report, $request );
}

View File

@ -54,7 +54,7 @@ class Orders extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -98,7 +98,7 @@ class Orders extends Reports {
* Prepare a report object for serialization.
*
* @param stdClass $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -119,7 +119,7 @@ class Orders extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_orders', $response, $report, $request );
}

View File

@ -111,7 +111,7 @@ class PerformanceIndicators extends Reports {
return true;
}
$request = new WP_REST_Request( 'GET', '/wc/v4/reports' );
$request = new \WP_REST_Request( 'GET', '/wc/v4/reports' );
$response = rest_do_request( $request );
$endpoints = $response->get_data();
$allowed_stats = array();
@ -121,7 +121,7 @@ class PerformanceIndicators extends Reports {
foreach ( $endpoints as $endpoint ) {
if ( '/stats' === substr( $endpoint['slug'], -6 ) ) {
$request = new WP_REST_Request( 'OPTIONS', $endpoint['path'] );
$request = new \WP_REST_Request( 'OPTIONS', $endpoint['path'] );
$response = rest_do_request( $request );
$data = $response->get_data();
@ -155,7 +155,7 @@ class PerformanceIndicators extends Reports {
/**
* Returns a list of allowed performance indicators.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_allowed_items( $request ) {
@ -244,7 +244,7 @@ class PerformanceIndicators extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -271,7 +271,7 @@ class PerformanceIndicators extends Reports {
}
$request_url = $this->endpoints[ $report ];
$request = new WP_REST_Request( 'GET', $request_url );
$request = new \WP_REST_Request( 'GET', $request_url );
$request->set_param( 'before', $query_args['before'] );
$request->set_param( 'after', $query_args['after'] );
@ -322,7 +322,7 @@ class PerformanceIndicators extends Reports {
* Prepare a report object for serialization.
*
* @param stdClass $stat_data Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $stat_data, $request ) {
@ -342,7 +342,7 @@ class PerformanceIndicators extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_performance_indicators', $response, $stat_data, $request );
}

View File

@ -44,7 +44,7 @@ class ProductStats extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -114,7 +114,7 @@ class ProductStats extends Reports {
* Prepare a report object for serialization.
*
* @param Array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -134,7 +134,7 @@ class ProductStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_products_stats', $response, $report, $request );
}

View File

@ -37,7 +37,7 @@ class Products extends Reports {
/**
* Get items.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
*
* @return array|\WP_Error
*/
@ -92,7 +92,7 @@ class Products extends Reports {
* Prepare a report object for serialization.
*
* @param Array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -113,7 +113,7 @@ class Products extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_products', $response, $report, $request );
}

View File

@ -48,7 +48,7 @@ class RevenueStats extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -98,7 +98,7 @@ class RevenueStats extends Reports {
* Prepare a report object for serialization.
*
* @param Array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -118,7 +118,7 @@ class RevenueStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_revenue_stats', $response, $report, $request );
}

View File

@ -28,7 +28,7 @@ class Stock extends Reports {
/**
* Maps query arguments from the REST request.
*
* @param WP_REST_Request $request Request array.
* @param \WP_REST_Request $request Request array.
* @return array
*/
protected function prepare_reports_query( $request ) {
@ -139,7 +139,7 @@ class Stock extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -182,7 +182,7 @@ class Stock extends Reports {
* Prepare a report object for serialization.
*
* @param WC_Product $product Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $product, $request ) {
@ -211,7 +211,7 @@ class Stock extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param WC_Product $product The original product object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_stock', $response, $product, $request );
}

View File

@ -28,7 +28,7 @@ class StockStats extends Reports {
/**
* Get Stock Status Totals.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -44,7 +44,7 @@ class StockStats extends Reports {
* Prepare a report object for serialization.
*
* @param WC_Product $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -64,7 +64,7 @@ class StockStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param WC_Product $product The original bject.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_stock_stats', $response, $product, $request );
}

View File

@ -79,7 +79,7 @@ class TaxStats extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -125,7 +125,7 @@ class TaxStats extends Reports {
* Prepare a report object for serialization.
*
* @param stdClass $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -145,7 +145,7 @@ class TaxStats extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_taxes_stats', $response, $report, $request );
}

View File

@ -47,7 +47,7 @@ class Taxes extends Reports {
/**
* Get all reports.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return array|\WP_Error
*/
public function get_items( $request ) {
@ -90,7 +90,7 @@ class Taxes extends Reports {
* Prepare a report object for serialization.
*
* @param stdClass $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -109,7 +109,7 @@ class Taxes extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_taxes', $response, $report, $request );
}

View File

@ -37,7 +37,7 @@ class Variations extends Reports {
/**
* Get items.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
*
* @return array|\WP_Error
*/
@ -92,7 +92,7 @@ class Variations extends Reports {
* Prepare a report object for serialization.
*
* @param array $report Report data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $report, $request ) {
@ -113,7 +113,7 @@ class Variations extends Reports {
*
* @param WP_REST_Response $response The response object.
* @param object $report The original report object.
* @param WP_REST_Request $request Request used to generate the response.
* @param \WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'woocommerce_rest_prepare_report_variations', $response, $report, $request );
}

View File

@ -58,7 +58,7 @@ class Settings extends AbstractController {
/**
* Makes sure the current user has access to WRITE the settings APIs.
*
* @param WP_REST_Request $request Full data about the request.
* @param \WP_REST_Request $request Full data about the request.
* @return \WP_Error|bool
*/
public function update_items_permissions_check( $request ) {
@ -72,7 +72,7 @@ class Settings extends AbstractController {
/**
* Update a setting.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -86,7 +86,7 @@ class Settings extends AbstractController {
* Get all settings groups items.
*
* @since 3.0.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -142,7 +142,7 @@ class Settings extends AbstractController {
*
* @since 3.0.0
* @param array $item Group object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -203,7 +203,7 @@ class Settings extends AbstractController {
* Makes sure the current user has access to READ the settings APIs.
*
* @since 3.0.0
* @param WP_REST_Request $request Full data about the request.
* @param \WP_REST_Request $request Full data about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {

View File

@ -102,7 +102,7 @@ class SettingsOptions extends AbstractController {
* Return a single setting.
*
* @since 3.0.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -121,7 +121,7 @@ class SettingsOptions extends AbstractController {
* Return all settings in a group.
*
* @since 3.0.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -273,7 +273,7 @@ class SettingsOptions extends AbstractController {
* Bulk create, update and delete items.
*
* @since 3.0.0
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return array Of \WP_Error or WP_REST_Response.
*/
public function batch_items( $request ) {
@ -289,7 +289,7 @@ class SettingsOptions extends AbstractController {
foreach ( $items['update'] as $item ) {
$to_update[] = array_merge( $request->get_url_params(), $item );
}
$request = new WP_REST_Request( $request->get_method() );
$request = new \WP_REST_Request( $request->get_method() );
$request->set_body_params( array( 'update' => $to_update ) );
}
@ -300,7 +300,7 @@ class SettingsOptions extends AbstractController {
* Update a single setting in a group.
*
* @since 3.0.0
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -343,7 +343,7 @@ class SettingsOptions extends AbstractController {
*
* @since 3.0.0
* @param object $item Setting object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {
@ -382,7 +382,7 @@ class SettingsOptions extends AbstractController {
* Makes sure the current user has access to READ the settings APIs.
*
* @since 3.0.0
* @param WP_REST_Request $request Full data about the request.
* @param \WP_REST_Request $request Full data about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -397,7 +397,7 @@ class SettingsOptions extends AbstractController {
* Makes sure the current user has access to WRITE the settings APIs.
*
* @since 3.0.0
* @param WP_REST_Request $request Full data about the request.
* @param \WP_REST_Request $request Full data about the request.
* @return \WP_Error|boolean
*/
public function update_items_permissions_check( $request ) {

View File

@ -66,7 +66,7 @@ class ShippingMethods extends AbstractController {
/**
* Check whether a given request has permission to view shipping methods.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -79,7 +79,7 @@ class ShippingMethods extends AbstractController {
/**
* Check if a given request has access to read a shipping method.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -92,7 +92,7 @@ class ShippingMethods extends AbstractController {
/**
* Get shipping methods.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -109,7 +109,7 @@ class ShippingMethods extends AbstractController {
/**
* Get a single Shipping Method.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function get_item( $request ) {
@ -129,7 +129,7 @@ class ShippingMethods extends AbstractController {
* Prepare a shipping method for response.
*
* @param WC_Shipping_Method $method Shipping method object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $method, $request ) {
@ -153,7 +153,7 @@ class ShippingMethods extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param WC_Shipping_Method $method Shipping method object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_shipping_method', $response, $method, $request );
}
@ -162,7 +162,7 @@ class ShippingMethods extends AbstractController {
* Prepare links for the request.
*
* @param WC_Shipping_Method $method Shipping method object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return array
*/
protected function prepare_links( $method, $request ) {

View File

@ -49,7 +49,7 @@ class ShippingZoneLocations extends AbstractShippingZonesController {
/**
* Get all Shipping Zone Locations.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function get_items( $request ) {
@ -74,7 +74,7 @@ class ShippingZoneLocations extends AbstractShippingZonesController {
/**
* Update all Shipping Zone Locations.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function update_items( $request ) {
@ -118,7 +118,7 @@ class ShippingZoneLocations extends AbstractShippingZonesController {
* Prepare the Shipping Zone Location for the REST response.
*
* @param array $item Shipping Zone Location.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {

View File

@ -99,7 +99,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
/**
* Get a single Shipping Zone Method.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function get_item( $request ) {
@ -132,7 +132,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
/**
* Get all Shipping Zone Methods.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function get_items( $request ) {
@ -156,8 +156,8 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
/**
* Create a new shipping zone method instance.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function create_item( $request ) {
$method_id = $request['method_id'];
@ -192,7 +192,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
/**
* Delete a shipping method instance.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function delete_item( $request ) {
@ -238,7 +238,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
*
* @param object $method
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( 'rest_delete_product_review', $method, $response, $request );
@ -248,7 +248,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
/**
* Update A Single Shipping Zone Method.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function update_item( $request ) {
@ -286,7 +286,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
*
* @param int $instance_id Instance ID.
* @param WC_Shipping_Method $method Shipping method data.
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
*
* @return WC_Shipping_Method
*/
@ -341,7 +341,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
* Prepare the Shipping Zone Method for the REST response.
*
* @param array $item Shipping Zone Method.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {

View File

@ -89,7 +89,7 @@ class ShippingZones extends AbstractShippingZonesController {
/**
* Get a single Shipping Zone.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response|\WP_Error
*/
public function get_item( $request ) {
@ -109,7 +109,7 @@ class ShippingZones extends AbstractShippingZonesController {
/**
* Get all Shipping Zones.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return WP_REST_Response
*/
public function get_items( $request ) {
@ -131,8 +131,8 @@ class ShippingZones extends AbstractShippingZonesController {
/**
* Create a single Shipping Zone.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function create_item( $request ) {
$zone = new \WC_Shipping_Zone( null );
@ -161,8 +161,8 @@ class ShippingZones extends AbstractShippingZonesController {
/**
* Update a single Shipping Zone.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function update_item( $request ) {
$zone = $this->get_zone( $request->get_param( 'id' ) );
@ -197,8 +197,8 @@ class ShippingZones extends AbstractShippingZonesController {
/**
* Delete a single Shipping Zone.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|\WP_Error
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_REST_Request|\WP_Error
*/
public function delete_item( $request ) {
$zone = $this->get_zone( $request->get_param( 'id' ) );
@ -224,7 +224,7 @@ class ShippingZones extends AbstractShippingZonesController {
* Prepare the Shipping Zone for the REST response.
*
* @param array $item Shipping Zone.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {

View File

@ -45,7 +45,7 @@ class SystemStatus extends AbstractController {
/**
* Check whether a given request has permission to view system status.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -58,7 +58,7 @@ class SystemStatus extends AbstractController {
/**
* Get a system status info, by section.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -1150,7 +1150,7 @@ class SystemStatus extends AbstractController {
* Prepare the system status response
*
* @param array $system_status System status data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response
*/
public function prepare_item_for_response( $system_status, $request ) {
@ -1164,7 +1164,7 @@ class SystemStatus extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param mixed $system_status System status
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_system_status', $response, $system_status, $request );
}

View File

@ -70,7 +70,7 @@ class SystemStatusTools extends AbstractController {
/**
* Check whether a given request has permission to view system status tools.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -83,7 +83,7 @@ class SystemStatusTools extends AbstractController {
/**
* Check whether a given request has permission to view a specific system status tool.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -96,7 +96,7 @@ class SystemStatusTools extends AbstractController {
/**
* Check whether a given request has permission to execute a specific system status tool.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
@ -203,7 +203,7 @@ class SystemStatusTools extends AbstractController {
/**
* Get a list of system status tools.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -229,7 +229,7 @@ class SystemStatusTools extends AbstractController {
/**
* Return a single tool.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -254,7 +254,7 @@ class SystemStatusTools extends AbstractController {
/**
* Update (execute) a tool.
*
* @param WP_REST_Request $request Request data.
* @param \WP_REST_Request $request Request data.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -278,7 +278,7 @@ class SystemStatusTools extends AbstractController {
* Fires after a WooCommerce REST system status tool has been executed.
*
* @param array $tool Details about the tool that has been executed.
* @param WP_REST_Request $request The current WP_REST_Request object.
* @param \WP_REST_Request $request The current \WP_REST_Request object.
*/
do_action( 'woocommerce_rest_insert_system_status_tool', $tool, $request );
@ -291,7 +291,7 @@ class SystemStatusTools extends AbstractController {
* Prepare a tool item for serialization.
*
* @param array $item Object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $item, $request ) {

View File

@ -77,7 +77,7 @@ class TaxClasses extends AbstractController {
/**
* Check whether a given request has permission to read tax classes.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -91,7 +91,7 @@ class TaxClasses extends AbstractController {
/**
* Check if a given request has access create tax classes.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -106,7 +106,7 @@ class TaxClasses extends AbstractController {
/**
* Check if a given request has access delete a tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -121,7 +121,7 @@ class TaxClasses extends AbstractController {
/**
* Get all tax classes.
*
* @param WP_REST_Request $request Request params.
* @param \WP_REST_Request $request Request params.
* @return array
*/
public function get_items( $request ) {
@ -155,7 +155,7 @@ class TaxClasses extends AbstractController {
/**
* Create a single tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -190,7 +190,7 @@ class TaxClasses extends AbstractController {
* Fires after a tax class is created or updated via the REST API.
*
* @param stdClass $tax_class Data used to create the tax class.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating tax class, false when updating tax class.
*/
do_action( 'woocommerce_rest_insert_tax_class', (object) $tax_class, $request, true );
@ -207,7 +207,7 @@ class TaxClasses extends AbstractController {
/**
* Delete a single tax class.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function delete_item( $request ) {
@ -268,7 +268,7 @@ class TaxClasses extends AbstractController {
*
* @param stdClass $tax_class The tax data.
* @param WP_REST_Response $response The response returned from the API.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( 'woocommerce_rest_delete_tax', (object) $tax_class, $response, $request );
@ -279,7 +279,7 @@ class TaxClasses extends AbstractController {
* Prepare a single tax class output for response.
*
* @param array $tax_class Tax class data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $tax_class, $request ) {
@ -299,7 +299,7 @@ class TaxClasses extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param stdClass $tax_class Tax object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_tax', $response, (object) $tax_class, $request );
}

View File

@ -105,7 +105,7 @@ class Taxes extends AbstractController {
/**
* Check whether a given request has permission to read taxes.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -119,7 +119,7 @@ class Taxes extends AbstractController {
/**
* Check if a given request has access create taxes.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -134,7 +134,7 @@ class Taxes extends AbstractController {
/**
* Check if a given request has access to read a tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -148,7 +148,7 @@ class Taxes extends AbstractController {
/**
* Check if a given request has access update a tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -163,7 +163,7 @@ class Taxes extends AbstractController {
/**
* Check if a given request has access delete a tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -178,7 +178,7 @@ class Taxes extends AbstractController {
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -193,7 +193,7 @@ class Taxes extends AbstractController {
/**
* Get all taxes and allow filtering by tax code.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -220,7 +220,7 @@ class Taxes extends AbstractController {
* Filter arguments, before passing to $wpdb->get_results(), when querying taxes via the REST API.
*
* @param array $prepared_args Array of arguments for $wpdb->get_results().
* @param WP_REST_Request $request The current request.
* @param \WP_REST_Request $request The current request.
*/
$prepared_args = apply_filters( 'woocommerce_rest_tax_query', $prepared_args, $request );
@ -302,7 +302,7 @@ class Taxes extends AbstractController {
/**
* Take tax data from the request and return the updated or newly created rate.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @param stdClass|null $current Existing tax object.
* @return object
*/
@ -372,7 +372,7 @@ class Taxes extends AbstractController {
/**
* Create a single tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -388,7 +388,7 @@ class Taxes extends AbstractController {
* Fires after a tax is created or updated via the REST API.
*
* @param stdClass $tax Data used to create the tax.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating tax, false when updating tax.
*/
do_action( 'woocommerce_rest_insert_tax', $tax, $request, true );
@ -405,7 +405,7 @@ class Taxes extends AbstractController {
/**
* Get a single tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -425,7 +425,7 @@ class Taxes extends AbstractController {
/**
* Update a single tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -444,7 +444,7 @@ class Taxes extends AbstractController {
* Fires after a tax is created or updated via the REST API.
*
* @param stdClass $tax Data used to create the tax.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param boolean $creating True when creating tax, false when updating tax.
*/
do_action( 'woocommerce_rest_insert_tax', $tax, $request, false );
@ -459,7 +459,7 @@ class Taxes extends AbstractController {
/**
* Delete a single tax.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function delete_item( $request ) {
@ -493,7 +493,7 @@ class Taxes extends AbstractController {
*
* @param stdClass $tax The tax data.
* @param WP_REST_Response $response The response returned from the API.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( 'woocommerce_rest_delete_tax', $tax, $response, $request );
@ -504,7 +504,7 @@ class Taxes extends AbstractController {
* Prepare a single tax output for response.
*
* @param stdClass $tax Tax object.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response( $tax, $request ) {
@ -558,7 +558,7 @@ class Taxes extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param stdClass $tax Tax object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( 'woocommerce_rest_prepare_tax', $response, $tax, $request );
}

View File

@ -111,7 +111,7 @@ class Webhooks extends AbstractController {
/**
* Check whether a given request has permission to read webhooks.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
@ -125,7 +125,7 @@ class Webhooks extends AbstractController {
/**
* Check if a given request has access create webhooks.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -140,7 +140,7 @@ class Webhooks extends AbstractController {
/**
* Check if a given request has access to read a webhook.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
@ -154,7 +154,7 @@ class Webhooks extends AbstractController {
/**
* Check if a given request has access update a webhook.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -169,7 +169,7 @@ class Webhooks extends AbstractController {
/**
* Check if a given request has access delete a webhook.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -184,7 +184,7 @@ class Webhooks extends AbstractController {
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
*
* @return bool|\WP_Error
*/
@ -209,7 +209,7 @@ class Webhooks extends AbstractController {
/**
* Get all webhooks.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_items( $request ) {
@ -232,7 +232,7 @@ class Webhooks extends AbstractController {
* Filter arguments, before passing to WC_Webhook_Data_Store->search_webhooks, when querying webhooks via the REST API.
*
* @param array $args Array of arguments for $wpdb->get_results().
* @param WP_REST_Request $request The current request.
* @param \WP_REST_Request $request The current request.
*/
$prepared_args = apply_filters( 'woocommerce_rest_webhook_query', $args, $request );
unset( $prepared_args['page'] );
@ -279,7 +279,7 @@ class Webhooks extends AbstractController {
/**
* Get a single item.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function get_item( $request ) {
@ -298,7 +298,7 @@ class Webhooks extends AbstractController {
/**
* Create a single webhook.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function create_item( $request ) {
@ -338,7 +338,7 @@ class Webhooks extends AbstractController {
* Fires after a single item is created or updated via the REST API.
*
* @param WC_Webhook $webhook Webhook data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_webhook_object", $webhook, $request, true );
@ -358,7 +358,7 @@ class Webhooks extends AbstractController {
/**
* Update a single webhook.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return \WP_Error|WP_REST_Response
*/
public function update_item( $request ) {
@ -418,7 +418,7 @@ class Webhooks extends AbstractController {
* Fires after a single item is created or updated via the REST API.
*
* @param WC_Webhook $webhook Webhook data.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @param bool $creating True when creating item, false when updating.
*/
do_action( "woocommerce_rest_insert_webhook_object", $webhook, $request, false );
@ -432,7 +432,7 @@ class Webhooks extends AbstractController {
/**
* Delete a single webhook.
*
* @param WP_REST_Request $request Full details about the request.
* @param \WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|\WP_Error
*/
public function delete_item( $request ) {
@ -464,7 +464,7 @@ class Webhooks extends AbstractController {
*
* @param WC_Webhook $webhook The deleted or trashed item.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
* @param \WP_REST_Request $request The request sent to the API.
*/
do_action( "woocommerce_rest_delete_webhook_object", $webhook, $response, $request );
@ -474,7 +474,7 @@ class Webhooks extends AbstractController {
/**
* Prepare a single webhook for create or update.
*
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return \WP_Error|stdClass $data Post object.
*/
protected function prepare_item_for_database( $request ) {
@ -519,7 +519,7 @@ class Webhooks extends AbstractController {
*
* @param stdClass $data An object representing a single item prepared
* for inserting or updating the database.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $data, $request );
}
@ -528,7 +528,7 @@ class Webhooks extends AbstractController {
* Prepare a single webhook output for response.
*
* @param int $id Webhook ID.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $id, $request ) {
@ -567,7 +567,7 @@ class Webhooks extends AbstractController {
*
* @param WP_REST_Response $response The response object.
* @param WC_Webhook $webhook Webhook object used to create response.
* @param WP_REST_Request $request Request object.
* @param \WP_REST_Request $request Request object.
*/
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $webhook, $request );
}