PHPCS passing for abstract-wc-rest-posts-controller.php
This commit is contained in:
parent
fb3afa672d
commit
74ec8a4a14
|
@ -1,14 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* Abstract Rest Posts Controller Class
|
||||
*
|
||||
* @class WC_REST_Posts_Controller
|
||||
* @package WooCommerce/Abstracts
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract Rest Posts Controller Class
|
||||
* WC_REST_Posts_Controller
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category API
|
||||
* @package WooCommerce/Abstracts
|
||||
* @version 2.6.0
|
||||
*/
|
||||
|
@ -223,8 +227,8 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
/**
|
||||
* Add post meta fields.
|
||||
*
|
||||
* @param WP_Post $post
|
||||
* @param WP_REST_Request $request
|
||||
* @param WP_Post $post Post Object.
|
||||
* @param WP_REST_Request $request WP_REST_Request Object.
|
||||
* @return bool|WP_Error
|
||||
*/
|
||||
protected function add_post_meta_fields( $post, $request ) {
|
||||
|
@ -234,7 +238,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
/**
|
||||
* Delete post.
|
||||
*
|
||||
* @param WP_Post $post
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
protected function delete_post( $post ) {
|
||||
wp_delete_post( $post->ID, true );
|
||||
|
@ -364,7 +368,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
$total_posts = $posts_query->found_posts;
|
||||
|
||||
if ( $total_posts < 1 ) {
|
||||
// Out-of-bounds, run the query again without LIMIT for total count
|
||||
// Out-of-bounds, run the query again without LIMIT for total count.
|
||||
unset( $query_args['paged'] );
|
||||
$count_query = new WP_Query();
|
||||
$count_query->query( $query_args );
|
||||
|
@ -478,7 +482,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
/**
|
||||
* Prepare links for the request.
|
||||
*
|
||||
* @param WP_Post $post Post object.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
* @return array Links for the given post.
|
||||
*/
|
||||
|
@ -499,8 +503,8 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
* Determine the allowed query_vars for a get_items() response and
|
||||
* prepare for WP_Query.
|
||||
*
|
||||
* @param array $prepared_args
|
||||
* @param WP_REST_Request $request
|
||||
* @param array $prepared_args Prepared arguments.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
* @return array $query_args
|
||||
*/
|
||||
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
|
||||
|
@ -515,7 +519,6 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
* The dynamic portion of the hook name, $var, refers to the query_var key.
|
||||
*
|
||||
* @param mixed $prepared_args[ $var ] The query_var value.
|
||||
*
|
||||
*/
|
||||
$query_args[ $var ] = apply_filters( "woocommerce_rest_query_var-{$var}", $prepared_args[ $var ] );
|
||||
}
|
||||
|
@ -526,7 +529,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
if ( 'include' === $query_args['orderby'] ) {
|
||||
$query_args['orderby'] = 'post__in';
|
||||
} elseif ( 'id' === $query_args['orderby'] ) {
|
||||
$query_args['orderby'] = 'ID'; // ID must be capitalized
|
||||
$query_args['orderby'] = 'ID'; // ID must be capitalized.
|
||||
}
|
||||
|
||||
return $query_args;
|
||||
|
@ -708,8 +711,8 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
|
|||
/**
|
||||
* Update post meta fields.
|
||||
*
|
||||
* @param WP_Post $post
|
||||
* @param WP_REST_Request $request
|
||||
* @param WP_Post $post Post object.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
* @return bool|WP_Error
|
||||
*/
|
||||
protected function update_post_meta_fields( $post, $request ) {
|
||||
|
|
Loading…
Reference in New Issue