phpcs sniff fixes for abstract-wc-order.php

This commit is contained in:
Ron Rennick 2019-01-27 11:38:08 -04:00
parent d32f189f27
commit 3f24ad8d4c
1 changed files with 27 additions and 18 deletions

View File

@ -403,7 +403,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$subtotal += $item->get_subtotal(); $subtotal += $item->get_subtotal();
} }
return apply_filters( 'woocommerce_order_get_subtotal', (double) $subtotal, $this ); return apply_filters( 'woocommerce_order_get_subtotal', (float) $subtotal, $this );
} }
/** /**
@ -692,13 +692,16 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @return string * @return string
*/ */
protected function type_to_group( $type ) { protected function type_to_group( $type ) {
$type_to_group = apply_filters( 'woocommerce_order_type_to_group', array( $type_to_group = apply_filters(
'line_item' => 'line_items', 'woocommerce_order_type_to_group',
'tax' => 'tax_lines', array(
'shipping' => 'shipping_lines', 'line_item' => 'line_items',
'fee' => 'fee_lines', 'tax' => 'tax_lines',
'coupon' => 'coupon_lines', 'shipping' => 'shipping_lines',
) ); 'fee' => 'fee_lines',
'coupon' => 'coupon_lines',
)
);
return isset( $type_to_group[ $type ] ) ? $type_to_group[ $type ] : ''; return isset( $type_to_group[ $type ] ) ? $type_to_group[ $type ] : '';
} }
@ -1285,12 +1288,15 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$tax_based_on = 'billing'; $tax_based_on = 'billing';
} }
$args = wp_parse_args( $args, array( $args = wp_parse_args(
'country' => 'billing' === $tax_based_on ? $this->get_billing_country() : $this->get_shipping_country(), $args,
'state' => 'billing' === $tax_based_on ? $this->get_billing_state() : $this->get_shipping_state(), array(
'postcode' => 'billing' === $tax_based_on ? $this->get_billing_postcode() : $this->get_shipping_postcode(), 'country' => 'billing' === $tax_based_on ? $this->get_billing_country() : $this->get_shipping_country(),
'city' => 'billing' === $tax_based_on ? $this->get_billing_city() : $this->get_shipping_city(), 'state' => 'billing' === $tax_based_on ? $this->get_billing_state() : $this->get_shipping_state(),
) ); 'postcode' => 'billing' === $tax_based_on ? $this->get_billing_postcode() : $this->get_shipping_postcode(),
'city' => 'billing' === $tax_based_on ? $this->get_billing_city() : $this->get_shipping_city(),
)
);
// Default to base. // Default to base.
if ( 'base' === $tax_based_on || empty( $args['country'] ) ) { if ( 'base' === $tax_based_on || empty( $args['country'] ) ) {
@ -1619,10 +1625,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
if ( 'excl' === $tax_display ) { if ( 'excl' === $tax_display ) {
$ex_tax_label = $this->get_prices_include_tax() ? 1 : 0; $ex_tax_label = $this->get_prices_include_tax() ? 1 : 0;
$subtotal = wc_price( $this->get_line_subtotal( $item ), array( $subtotal = wc_price(
'ex_tax_label' => $ex_tax_label, $this->get_line_subtotal( $item ),
'currency' => $this->get_currency(), array(
) ); 'ex_tax_label' => $ex_tax_label,
'currency' => $this->get_currency(),
)
);
} else { } else {
$subtotal = wc_price( $this->get_line_subtotal( $item, true ), array( 'currency' => $this->get_currency() ) ); $subtotal = wc_price( $this->get_line_subtotal( $item, true ), array( 'currency' => $this->get_currency() ) );
} }