Fixed includes/class-wc-customer.php PHPCS violations

This commit is contained in:
Claudio Sanches 2018-03-19 20:15:16 -03:00
parent 37a9af55c0
commit d528e65849
1 changed files with 127 additions and 160 deletions

View File

@ -1,18 +1,17 @@
<?php
include_once( 'legacy/class-wc-legacy-customer.php' );
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WooCommerce customer class handles storage of the current customer's data, such as location.
*
* @class WC_Customer
* @version 3.0.0
* @package WooCommerce/Classes
* @category Class
* @author WooThemes
* @package WooCommerce/Classes
* @version 3.0.0
*/
defined( 'ABSPATH' ) || exit;
require_once dirname( __FILE__ ) . '/legacy/class-wc-legacy-customer.php';
/**
* Customer class.
*/
class WC_Customer extends WC_Legacy_Customer {
@ -31,28 +30,28 @@ class WC_Customer extends WC_Legacy_Customer {
'role' => 'customer',
'username' => '',
'billing' => array(
'first_name' => '',
'last_name' => '',
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'state' => '',
'postcode' => '',
'country' => '',
'email' => '',
'phone' => '',
'first_name' => '',
'last_name' => '',
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'state' => '',
'postcode' => '',
'country' => '',
'email' => '',
'phone' => '',
),
'shipping' => array(
'first_name' => '',
'last_name' => '',
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'state' => '',
'postcode' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'state' => '',
'postcode' => '',
'country' => '',
),
'is_paying_customer' => false,
);
@ -84,9 +83,9 @@ class WC_Customer extends WC_Legacy_Customer {
* If $customer is 'new', you can build a new WC_Customer object. If it's empty, some
* data will be pulled from the session for the current user/customer.
*
* @param WC_Customer|int $data Customer ID or data.
* @param bool $is_session True if this is the customer session
* @throws Exception if customer cannot be read/found and $data is set.
* @param WC_Customer|int $data Customer ID or data.
* @param bool $is_session True if this is the customer session.
* @throws Exception If customer cannot be read/found and $data is set.
*/
public function __construct( $data = 0, $is_session = false ) {
parent::__construct( $data );
@ -137,7 +136,12 @@ class WC_Customer extends WC_Legacy_Customer {
*/
public function delete_and_reassign( $reassign = null ) {
if ( $this->data_store ) {
$this->data_store->delete( $this, array( 'force_delete' => true, 'reassign' => $reassign ) );
$this->data_store->delete(
$this, array(
'force_delete' => true,
'reassign' => $reassign,
)
);
$this->set_id( 0 );
return true;
}
@ -175,13 +179,14 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get taxable address.
*
* @return array
*/
public function get_taxable_address() {
$tax_based_on = get_option( 'woocommerce_tax_based_on' );
// Check shipping method at this point to see if we need special handling
if ( true === apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) && sizeof( array_intersect( wc_get_chosen_shipping_method_ids(), apply_filters( 'woocommerce_local_pickup_methods', array( 'legacy_local_pickup', 'local_pickup' ) ) ) ) > 0 ) {
// Check shipping method at this point to see if we need special handling.
if ( true === apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) && count( array_intersect( wc_get_chosen_shipping_method_ids(), apply_filters( 'woocommerce_local_pickup_methods', array( 'legacy_local_pickup', 'local_pickup' ) ) ) ) > 0 ) {
$tax_based_on = 'base';
}
@ -267,7 +272,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set if customer has tax exemption.
*
* @param bool $is_vat_exempt
* @param bool $is_vat_exempt If is vat exempt.
*/
public function set_is_vat_exempt( $is_vat_exempt ) {
$this->is_vat_exempt = wc_string_to_bool( $is_vat_exempt );
@ -276,7 +281,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Calculated shipping?
*
* @param boolean $calculated
* @param bool $calculated If shipping is calculated.
*/
public function set_calculated_shipping( $calculated = true ) {
$this->calculated_shipping = wc_string_to_bool( $calculated );
@ -286,8 +291,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Set customer's password.
*
* @since 3.0.0
* @param string $password
* @throws WC_Data_Exception
* @param string $password Password.
*/
public function set_password( $password ) {
$this->password = wc_clean( $password );
@ -296,7 +300,6 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Gets the customers last order.
*
* @param WC_Customer
* @return WC_Order|false
*/
public function get_last_order() {
@ -306,7 +309,6 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Return the number of orders this customer has.
*
* @param WC_Customer
* @return integer
*/
public function get_order_count() {
@ -316,7 +318,6 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Return how much money this customer has spent.
*
* @param WC_Customer
* @return float
*/
public function get_total_spent() {
@ -324,16 +325,16 @@ class WC_Customer extends WC_Legacy_Customer {
}
/*
|--------------------------------------------------------------------------
| Getters
|--------------------------------------------------------------------------
*/
|--------------------------------------------------------------------------
| Getters
|--------------------------------------------------------------------------
*/
/**
* Return the customer's username.
*
* @since 3.0.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_username( $context = 'view' ) {
@ -344,7 +345,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Return the customer's email.
*
* @since 3.0.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_email( $context = 'view' ) {
@ -355,7 +356,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Return customer's first name.
*
* @since 3.0.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_first_name( $context = 'view' ) {
@ -366,7 +367,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Return customer's last name.
*
* @since 3.0.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_last_name( $context = 'view' ) {
@ -377,7 +378,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Return customer's display name.
*
* @since 3.1.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_display_name( $context = 'view' ) {
@ -388,7 +389,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Return customer's user role.
*
* @since 3.0.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_role( $context = 'view' ) {
@ -399,7 +400,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Return the date this customer was created.
*
* @since 3.0.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return WC_DateTime|null object if the date is set or null if there is no date.
*/
public function get_date_created( $context = 'view' ) {
@ -410,7 +411,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Return the date this customer was last updated.
*
* @since 3.0.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return WC_DateTime|null object if the date is set or null if there is no date.
*/
public function get_date_modified( $context = 'view' ) {
@ -423,7 +424,7 @@ class WC_Customer extends WC_Legacy_Customer {
* @since 3.0.0
* @param string $prop Name of prop to get.
* @param string $address billing or shipping.
* @param string $context What the value is for. Valid values are view and edit.
* @param string $context What the value is for. Valid values are 'view' and 'edit'. What the value is for. Valid values are view and edit.
* @return mixed
*/
protected function get_address_prop( $prop, $address = 'billing', $context = 'view' ) {
@ -443,7 +444,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Get billing.
*
* @since 3.2.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return array
*/
public function get_billing( $context = 'view' ) {
@ -453,7 +454,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_first_name.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_first_name( $context = 'view' ) {
@ -463,7 +464,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_last_name.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_last_name( $context = 'view' ) {
@ -473,7 +474,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_company.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_company( $context = 'view' ) {
@ -483,7 +484,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_address_1.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_address( $context = 'view' ) {
@ -493,7 +494,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_address_1.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_address_1( $context = 'view' ) {
@ -503,7 +504,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_address_2.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string $value
*/
public function get_billing_address_2( $context = 'view' ) {
@ -513,7 +514,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_city.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string $value
*/
public function get_billing_city( $context = 'view' ) {
@ -523,7 +524,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_state.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_state( $context = 'view' ) {
@ -533,7 +534,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_postcode.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_postcode( $context = 'view' ) {
@ -543,7 +544,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_country.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_country( $context = 'view' ) {
@ -553,7 +554,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_email.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_email( $context = 'view' ) {
@ -563,7 +564,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get billing_phone.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_billing_phone( $context = 'view' ) {
@ -574,7 +575,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Get shipping.
*
* @since 3.2.0
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return array
*/
public function get_shipping( $context = 'view' ) {
@ -584,7 +585,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_first_name.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_first_name( $context = 'view' ) {
@ -594,17 +595,17 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_last_name.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_last_name( $context = 'view' ) {
return $this->get_address_prop( 'last_name', 'shipping', $context );
return $this->get_address_prop( 'last_name', 'shipping', $context );
}
/**
* Get shipping_company.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_company( $context = 'view' ) {
@ -614,7 +615,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_address_1.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_address( $context = 'view' ) {
@ -624,7 +625,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_address_1.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_address_1( $context = 'view' ) {
@ -634,7 +635,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_address_2.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_address_2( $context = 'view' ) {
@ -644,7 +645,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_city.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_city( $context = 'view' ) {
@ -654,7 +655,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_state.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_state( $context = 'view' ) {
@ -664,7 +665,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_postcode.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_postcode( $context = 'view' ) {
@ -674,7 +675,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Get shipping_country.
*
* @param string $context
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return string
*/
public function get_shipping_country( $context = 'view' ) {
@ -684,11 +685,11 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Is the user a paying customer?
*
* @since 3.0.0
* @param string $context
* @since 3.0.0
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
* @return bool
*/
function get_is_paying_customer( $context = 'view' ) {
public function get_is_paying_customer( $context = 'view' ) {
return $this->get_prop( 'is_paying_customer', $context );
}
@ -702,8 +703,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Set customer's username.
*
* @since 3.0.0
* @param string $username
* @throws WC_Data_Exception
* @param string $username Username.
*/
public function set_username( $username ) {
$this->set_prop( 'username', $username );
@ -713,8 +713,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Set customer's email.
*
* @since 3.0.0
* @param string $value
* @throws WC_Data_Exception
* @param string $value Email.
*/
public function set_email( $value ) {
if ( $value && ! is_email( $value ) ) {
@ -727,8 +726,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Set customer's first name.
*
* @since 3.0.0
* @param string $first_name
* @throws WC_Data_Exception
* @param string $first_name First name.
*/
public function set_first_name( $first_name ) {
$this->set_prop( 'first_name', $first_name );
@ -738,8 +736,7 @@ class WC_Customer extends WC_Legacy_Customer {
* Set customer's last name.
*
* @since 3.0.0
* @param string $last_name
* @throws WC_Data_Exception
* @param string $last_name Last name.
*/
public function set_last_name( $last_name ) {
$this->set_prop( 'last_name', $last_name );
@ -753,20 +750,19 @@ class WC_Customer extends WC_Legacy_Customer {
*/
public function set_display_name( $display_name ) {
/* translators: 1: first name 2: last name */
$this->set_prop( 'display_name', is_email( $display_name ) ? sprintf( __( '%1$s %2$s', 'display name', 'woocommerce' ), $this->get_first_name(), $this->get_last_name() ) : $display_name );
$this->set_prop( 'display_name', is_email( $display_name ) ? sprintf( _x( '%1$s %2$s', 'display name', 'woocommerce' ), $this->get_first_name(), $this->get_last_name() ) : $display_name );
}
/**
* Set customer's user role(s).
*
* @since 3.0.0
* @param mixed $role
* @throws WC_Data_Exception
* @param mixed $role User role.
*/
public function set_role( $role ) {
global $wp_roles;
if ( $role && ! empty( $wp_roles->roles ) && ! in_array( $role, array_keys( $wp_roles->roles ) ) ) {
if ( $role && ! empty( $wp_roles->roles ) && ! in_array( $role, array_keys( $wp_roles->roles ), true ) ) {
$this->error( 'customer_invalid_role', __( 'Invalid role', 'woocommerce' ) );
}
$this->set_prop( 'role', $role );
@ -777,7 +773,6 @@ class WC_Customer extends WC_Legacy_Customer {
*
* @since 3.0.0
* @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if their is no date.
* @throws WC_Data_Exception
*/
public function set_date_created( $date = null ) {
$this->set_date_prop( 'date_created', $date );
@ -788,7 +783,6 @@ class WC_Customer extends WC_Legacy_Customer {
*
* @since 3.0.0
* @param string|integer|null $date UTC timestamp, or ISO 8601 DateTime. If the DateTime string has no timezone or offset, WordPress site timezone will be assumed. Null if their is no date.
* @throws WC_Data_Exception
*/
public function set_date_modified( $date = null ) {
$this->set_date_prop( 'date_modified', $date );
@ -798,7 +792,6 @@ class WC_Customer extends WC_Legacy_Customer {
* Set customer address to match shop base address.
*
* @since 3.0.0
* @throws WC_Data_Exception
*/
public function set_billing_address_to_base() {
$base = wc_get_customer_default_location();
@ -809,7 +802,6 @@ class WC_Customer extends WC_Legacy_Customer {
* Set customer shipping address to base address.
*
* @since 3.0.0
* @throws WC_Data_Exception
*/
public function set_shipping_address_to_base() {
$base = wc_get_customer_default_location();
@ -819,11 +811,10 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Sets all address info at once.
*
* @param string $country
* @param string $state
* @param string $postcode
* @param string $city
* @throws WC_Data_Exception
* @param string $country Country.
* @param string $state State.
* @param string $postcode Postcode.
* @param string $city City.
*/
public function set_billing_location( $country, $state = '', $postcode = '', $city = '' ) {
$billing = $this->get_prop( 'billing', 'edit' );
@ -837,11 +828,10 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Sets all shipping info at once.
*
* @param string $country
* @param string $state
* @param string $postcode
* @param string $city
* @throws WC_Data_Exception
* @param string $country Country.
* @param string $state State.
* @param string $postcode Postcode.
* @param string $city City.
*/
public function set_shipping_location( $country, $state = '', $postcode = '', $city = '' ) {
$shipping = $this->get_prop( 'shipping', 'edit' );
@ -856,9 +846,9 @@ class WC_Customer extends WC_Legacy_Customer {
* Sets a prop for a setter method.
*
* @since 3.0.0
* @param string $prop Name of prop to set.
* @param string $prop Name of prop to set.
* @param string $address Name of address to set. billing or shipping.
* @param mixed $value Value of the prop.
* @param mixed $value Value of the prop.
*/
protected function set_address_prop( $prop, $address = 'billing', $value ) {
if ( array_key_exists( $prop, $this->data[ $address ] ) ) {
@ -875,8 +865,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_first_name.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing first name.
*/
public function set_billing_first_name( $value ) {
$this->set_address_prop( 'first_name', 'billing', $value );
@ -885,8 +874,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_last_name.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing last name.
*/
public function set_billing_last_name( $value ) {
$this->set_address_prop( 'last_name', 'billing', $value );
@ -895,8 +883,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_company.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing company.
*/
public function set_billing_company( $value ) {
$this->set_address_prop( 'company', 'billing', $value );
@ -905,8 +892,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_address_1.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing address line 1.
*/
public function set_billing_address( $value ) {
$this->set_billing_address_1( $value );
@ -915,8 +901,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_address_1.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing address line 1.
*/
public function set_billing_address_1( $value ) {
$this->set_address_prop( 'address_1', 'billing', $value );
@ -925,8 +910,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_address_2.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing address line 2.
*/
public function set_billing_address_2( $value ) {
$this->set_address_prop( 'address_2', 'billing', $value );
@ -935,8 +919,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_city.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing city.
*/
public function set_billing_city( $value ) {
$this->set_address_prop( 'city', 'billing', $value );
@ -945,8 +928,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_state.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing state.
*/
public function set_billing_state( $value ) {
$this->set_address_prop( 'state', 'billing', $value );
@ -955,8 +937,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_postcode.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing postcode.
*/
public function set_billing_postcode( $value ) {
$this->set_address_prop( 'postcode', 'billing', $value );
@ -965,8 +946,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_country.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing country.
*/
public function set_billing_country( $value ) {
$this->set_address_prop( 'country', 'billing', $value );
@ -975,8 +955,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_email.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing email.
*/
public function set_billing_email( $value ) {
if ( $value && ! is_email( $value ) ) {
@ -988,8 +967,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set billing_phone.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Billing phone.
*/
public function set_billing_phone( $value ) {
$this->set_address_prop( 'phone', 'billing', $value );
@ -998,8 +976,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_first_name.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping first name.
*/
public function set_shipping_first_name( $value ) {
$this->set_address_prop( 'first_name', 'shipping', $value );
@ -1008,8 +985,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_last_name.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping last name.
*/
public function set_shipping_last_name( $value ) {
$this->set_address_prop( 'last_name', 'shipping', $value );
@ -1018,8 +994,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_company.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping company.
*/
public function set_shipping_company( $value ) {
$this->set_address_prop( 'company', 'shipping', $value );
@ -1028,8 +1003,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_address_1.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping address line 1.
*/
public function set_shipping_address( $value ) {
$this->set_shipping_address_1( $value );
@ -1038,8 +1012,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_address_1.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping address line 1.
*/
public function set_shipping_address_1( $value ) {
$this->set_address_prop( 'address_1', 'shipping', $value );
@ -1048,8 +1021,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_address_2.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping address line 2.
*/
public function set_shipping_address_2( $value ) {
$this->set_address_prop( 'address_2', 'shipping', $value );
@ -1058,8 +1030,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_city.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping city.
*/
public function set_shipping_city( $value ) {
$this->set_address_prop( 'city', 'shipping', $value );
@ -1068,8 +1039,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_state.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping state.
*/
public function set_shipping_state( $value ) {
$this->set_address_prop( 'state', 'shipping', $value );
@ -1078,8 +1048,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_postcode.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping postcode.
*/
public function set_shipping_postcode( $value ) {
$this->set_address_prop( 'postcode', 'shipping', $value );
@ -1088,8 +1057,7 @@ class WC_Customer extends WC_Legacy_Customer {
/**
* Set shipping_country.
*
* @param string $value
* @throws WC_Data_Exception
* @param string $value Shipping country.
*/
public function set_shipping_country( $value ) {
$this->set_address_prop( 'country', 'shipping', $value );
@ -1099,10 +1067,9 @@ class WC_Customer extends WC_Legacy_Customer {
* Set if the user a paying customer.
*
* @since 3.0.0
* @param bool $is_paying_customer
* @throws WC_Data_Exception
* @param bool $is_paying_customer If is a paying customer.
*/
function set_is_paying_customer( $is_paying_customer ) {
public function set_is_paying_customer( $is_paying_customer ) {
$this->set_prop( 'is_paying_customer', (bool) $is_paying_customer );
}
}