Fixed coding standards
This commit is contained in:
parent
cae02bee36
commit
390844f73b
|
@ -1,25 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Handles storage and retrieval of shipping zones
|
||||
*
|
||||
* @package WooCommerce/Classes
|
||||
* @author Automattic
|
||||
* @version 3.3.0
|
||||
* @since 3.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles storage and retrieval of shipping zones
|
||||
*
|
||||
* @class WC_Shipping_Zones
|
||||
* @since 2.6.0
|
||||
* @version 3.0.0
|
||||
* @package WooCommerce/Classes
|
||||
* @category Class
|
||||
* @author WooCommerce
|
||||
* Shipping zones class.
|
||||
*/
|
||||
class WC_Shipping_Zones {
|
||||
|
||||
/**
|
||||
* Get shipping zones from the database
|
||||
* Get shipping zones from the database.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @return array of arrays
|
||||
* @return array Array of arrays.
|
||||
*/
|
||||
public static function get_zones() {
|
||||
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
||||
|
@ -27,7 +29,7 @@ class WC_Shipping_Zones {
|
|||
$zones = array();
|
||||
|
||||
foreach ( $raw_zones as $raw_zone ) {
|
||||
$zone = new WC_Shipping_Zone( $raw_zone );
|
||||
$zone = new WC_Shipping_Zone( $raw_zone );
|
||||
$zones[ $zone->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 ) {
|
||||
|
|
Loading…
Reference in New Issue