From cae02bee365d5fb12c92d2cdc537d57fd0950596 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 6 Dec 2017 19:07:00 -0200 Subject: [PATCH 1/3] Fixed undefined variable on WC_Shipping_Zones::get_zone_by --- includes/class-wc-shipping-zones.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/class-wc-shipping-zones.php b/includes/class-wc-shipping-zones.php index bcbfae2e892..2dd14acc52d 100644 --- a/includes/class-wc-shipping-zones.php +++ b/includes/class-wc-shipping-zones.php @@ -55,6 +55,8 @@ class WC_Shipping_Zones { * @return WC_Shipping_Zone|bool */ public static function get_zone_by( $by = 'zone_id', $id = 0 ) { + $zone_id = false; + switch ( $by ) { case 'zone_id' : $zone_id = $id; From 390844f73b925fecbec65a99d7fcc6843bc00e42 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 6 Dec 2017 19:11:40 -0200 Subject: [PATCH 2/3] Fixed coding standards --- includes/class-wc-shipping-zones.php | 53 +++++++++++++++------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/includes/class-wc-shipping-zones.php b/includes/class-wc-shipping-zones.php index 2dd14acc52d..5ee0407d129 100644 --- a/includes/class-wc-shipping-zones.php +++ b/includes/class-wc-shipping-zones.php @@ -1,25 +1,27 @@ get_id() ] = $zone->get_data(); $zones[ $zone->get_id() ]['zone_id'] = $zone->get_id(); $zones[ $zone->get_id() ]['formatted_zone_location'] = $zone->get_formatted_location(); @@ -39,8 +41,9 @@ class WC_Shipping_Zones { /** * Get shipping zone using it's ID + * * @since 2.6.0 - * @param int $zone_id + * @param int $zone_id Zone ID. * @return WC_Shipping_Zone|bool */ public static function get_zone( $zone_id ) { @@ -49,22 +52,23 @@ class WC_Shipping_Zones { /** * Get shipping zone by an ID. + * * @since 2.6.0 - * @param string $by zone_id or instance_id - * @param int $id + * @param string $by Get by 'zone_id' or 'instance_id'. + * @param int $id ID. * @return WC_Shipping_Zone|bool */ public static function get_zone_by( $by = 'zone_id', $id = 0 ) { $zone_id = false; switch ( $by ) { - case 'zone_id' : + case 'zone_id': $zone_id = $id; - break; - case 'instance_id' : + break; + case 'instance_id': $data_store = WC_Data_Store::load( 'shipping-zone' ); $zone_id = $data_store->get_zone_id_by_instance_id( $id ); - break; + break; } if ( false !== $zone_id ) { @@ -79,11 +83,10 @@ class WC_Shipping_Zones { } /** - * Get shipping zone using it's ID + * Get shipping zone using it's ID. + * * @since 2.6.0 - * - * @param $instance_id - * + * @param int $instance_id Instance ID. * @return bool|WC_Shipping_Method */ public static function get_shipping_method( $instance_id ) { @@ -104,7 +107,8 @@ class WC_Shipping_Zones { /** * Delete a zone using it's ID - * @param int $zone_id + * + * @param int $zone_id Zone ID. * @since 2.6.0 */ public static function delete_zone( $zone_id ) { @@ -114,9 +118,10 @@ class WC_Shipping_Zones { /** * Find a matching zone for a given package. + * * @since 2.6.0 * @uses wc_make_numeric_postcode() - * @param object $package + * @param array $package Shipping package. * @return WC_Shipping_Zone */ public static function get_zone_matching_package( $package ) { From bb575ad07ed05f38068d40ba921bbea988f75423 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 6 Dec 2017 19:12:42 -0200 Subject: [PATCH 3/3] Fixed @since --- includes/class-wc-shipping-zones.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-shipping-zones.php b/includes/class-wc-shipping-zones.php index 5ee0407d129..2ddfac2a61b 100644 --- a/includes/class-wc-shipping-zones.php +++ b/includes/class-wc-shipping-zones.php @@ -5,7 +5,7 @@ * @package WooCommerce/Classes * @author Automattic * @version 3.3.0 - * @since 3.3.0 + * @since 2.6.0 */ if ( ! defined( 'ABSPATH' ) ) {