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. * Handles requests to the /taxes/classes endpoint.
* *
* @author WooThemes
* @category API
* @package Automattic/WooCommerce/RestApi * @package Automattic/WooCommerce/RestApi
* @since 3.0.0 * @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. * Register the routes for tax classes.
*/ */
public function register_routes() { public function register_routes() {
register_rest_route( $this->namespace, '/' . $this->rest_base, array( register_rest_route(
$this->namespace,
'/' . $this->rest_base,
array( array(
'methods' => WP_REST_Server::READABLE, array(
'callback' => array( $this, 'get_items' ), 'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( $this, 'get_items_permissions_check' ), 'callback' => array( $this, 'get_items' ),
'args' => $this->get_collection_params(), '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::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( array(
'methods' => WP_REST_Server::READABLE, 'args' => array(
'callback' => array( $this, 'get_item' ), 'slug' => array(
'permission_callback' => array( $this, 'get_items_permissions_check' ), 'description' => __( 'Unique slug for the resource.', 'woocommerce' ),
), 'type' => 'string',
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' ),
), ),
), ),
), array(
'schema' => array( $this, 'get_public_item_schema' ), '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. * Get all tax classes.
* *
* @param WP_REST_Request $request * @param WP_REST_Request $request Request object.
* @return array * @return array
*/ */
public function get_items( $request ) { public function get_items( $request ) {
@ -165,7 +171,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller {
/** /**
* Get one tax class. * Get one tax class.
* *
* @param WP_REST_Request $request * @param WP_REST_Request $request Request object.
* @return array * @return array
*/ */
public function get_item( $request ) { 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. * 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. * @param WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data. * @return WP_REST_Response $response Response data.
*/ */