From 26361a3856b8522178b46b127da867b5ec6424c0 Mon Sep 17 00:00:00 2001 From: Luke Policinski Date: Sat, 27 Jan 2018 16:09:13 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- src/CartItem.php | 11 +++++------ src/LaraCart.php | 4 +++- tests/TotalsTest.php | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/CartItem.php b/src/CartItem.php index cb90ee3..cb665aa 100644 --- a/src/CartItem.php +++ b/src/CartItem.php @@ -278,8 +278,8 @@ public function getDiscount($format = true) * Gets the tax for the item. * * @param int $amountNotTaxable - * * @param int $totalDiscount + * * @return int|mixed */ public function tax($amountNotTaxable = 0, $totalDiscount = 0) @@ -296,8 +296,8 @@ public function tax($amountNotTaxable = 0, $totalDiscount = 0) $itemCount++; } - if($totalDiscount !== 0) { - $totalTax = $totalTax - ($totalDiscount - ($totalDiscount/(1 + $this->tax))); + if ($totalDiscount !== 0) { + $totalTax = $totalTax - ($totalDiscount - ($totalDiscount / (1 + $this->tax))); } return $totalTax - $amountNotTaxable; @@ -305,9 +305,8 @@ public function tax($amountNotTaxable = 0, $totalDiscount = 0) $totalTax = $this->tax * ($this->subTotal(false, !config('laracart.discountTaxable', false), true) - $amountNotTaxable); - - if($totalDiscount !== 0) { - $totalTax = $totalTax - ($totalDiscount - ($totalDiscount/(1 + $this->tax))); + if ($totalDiscount !== 0) { + $totalTax = $totalTax - ($totalDiscount - ($totalDiscount / (1 + $this->tax))); } return $totalTax; diff --git a/src/LaraCart.php b/src/LaraCart.php index 458bcf4..e2e2489 100644 --- a/src/LaraCart.php +++ b/src/LaraCart.php @@ -561,7 +561,8 @@ public function removeFees() * * @param bool|true $format * @param bool|true $withFees - * @param bool $grossTaxes + * @param bool $grossTaxes + * * @return string */ public function taxTotal($format = true, $withFees = true, $grossTaxes = true) @@ -600,6 +601,7 @@ public function taxTotal($format = true, $withFees = true, $grossTaxes = true) } } } + return $this->formatMoney($totalTax, null, null, $format); } diff --git a/tests/TotalsTest.php b/tests/TotalsTest.php index 3b11d21..7b91c40 100644 --- a/tests/TotalsTest.php +++ b/tests/TotalsTest.php @@ -305,7 +305,8 @@ public function testTaxationOnCoupons() $this->assertEquals(6639.12, $this->laracart->total(false)); } - public function testTaxationAndDiscount() { + public function testTaxationAndDiscount() + { $this->app['config']->set('laracart.tax', .19); $this->app['config']->set('laracart.tax_by_item', true); $this->app['config']->set('laracart.discountTaxable', false); @@ -322,7 +323,7 @@ public function testTaxationAndDiscount() { ); $coupon = new \LukePOLO\LaraCart\Coupons\Fixed('50EUR', 50, [ - 'description' => '50EUR' + 'description' => '50EUR', ]); $this->laracart->addCoupon($coupon);