phpcs fixes

This commit is contained in:
Ron Rennick 2020-08-12 14:34:57 -03:00
parent c605b93737
commit 71def437f7
1 changed files with 48 additions and 42 deletions

View File

@ -4,8 +4,6 @@
*
* Handles requests to the /taxes/classes endpoint.
*
* @author WooThemes
* @category API
* @package Automattic/WooCommerce/RestApi
* @since 3.0.0
*/
@ -40,48 +38,56 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller {
* Register the routes for tax classes.
*/
public function register_routes() {
register_rest_route( $this->namespace, '/' . $this->rest_base, array(
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_items' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => $this->get_collection_params(),
),
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( $this, 'create_item' ),
'permission_callback' => array( $this, 'create_item_permissions_check' ),
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
),
'schema' => array( $this, 'get_public_item_schema' ),
) );
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<slug>\w[\w\s\-]*)', array(
'args' => array(
'slug' => array(
'description' => __( 'Unique slug for the resource.', 'woocommerce' ),
'type' => 'string',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_items' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => $this->get_collection_params(),
),
),
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( $this, 'create_item' ),
'permission_callback' => array( $this, 'create_item_permissions_check' ),
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/(?P<slug>\w[\w\s\-]*)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_item' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
),
array(
'methods' => WP_REST_Server::DELETABLE,
'callback' => array( $this, 'delete_item' ),
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
'args' => array(
'force' => array(
'default' => false,
'type' => 'boolean',
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
'args' => array(
'slug' => array(
'description' => __( 'Unique slug for the resource.', 'woocommerce' ),
'type' => 'string',
),
),
),
'schema' => array( $this, 'get_public_item_schema' ),
) );
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_item' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
),
array(
'methods' => WP_REST_Server::DELETABLE,
'callback' => array( $this, 'delete_item' ),
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
'args' => array(
'force' => array(
'default' => false,
'type' => 'boolean',
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
),
),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
}
/**
@ -131,7 +137,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller {
/**
* Get all tax classes.
*
* @param WP_REST_Request $request
* @param WP_REST_Request $request Request object.
* @return array
*/
public function get_items( $request ) {
@ -165,7 +171,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller {
/**
* Get one tax class.
*
* @param WP_REST_Request $request
* @param WP_REST_Request $request Request object.
* @return array
*/
public function get_item( $request ) {
@ -266,7 +272,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller {
/**
* Prepare a single tax class output for response.
*
* @param array $tax_class Tax class data.
* @param array $tax_class Tax class data.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/