mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 23:51:25 +00:00
Codestyle
ignore tests added to styleci.yml
This commit is contained in:
@@ -501,13 +501,13 @@ class Cart
|
|||||||
/**
|
/**
|
||||||
* Set the global tax rate for the cart.
|
* Set the global tax rate for the cart.
|
||||||
* This will set the tax rate for all items.
|
* This will set the tax rate for all items.
|
||||||
*
|
*
|
||||||
* @param float $discount
|
* @param float $discount
|
||||||
*/
|
*/
|
||||||
public function setGlobalTax($taxRate)
|
public function setGlobalTax($taxRate)
|
||||||
{
|
{
|
||||||
$this->taxRate = $taxRate;
|
$this->taxRate = $taxRate;
|
||||||
|
|
||||||
$content = $this->getContent();
|
$content = $this->getContent();
|
||||||
if ($content && $content->count()) {
|
if ($content && $content->count()) {
|
||||||
$content->each(function ($item, $key) {
|
$content->each(function ($item, $key) {
|
||||||
@@ -597,7 +597,7 @@ class Cart
|
|||||||
if ($identifier instanceof InstanceIdentifier) {
|
if ($identifier instanceof InstanceIdentifier) {
|
||||||
$identifier = $identifier->getInstanceIdentifier();
|
$identifier = $identifier->getInstanceIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->storedCartWithIdentifierExists($identifier)) {
|
if (!$this->storedCartWithIdentifierExists($identifier)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -685,6 +685,7 @@ class Cart
|
|||||||
if ($this->session->has($this->instance)) {
|
if ($this->session->has($this->instance)) {
|
||||||
return $this->session->get($this->instance);
|
return $this->session->get($this->instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Collection();
|
return new Collection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,6 +729,7 @@ class Cart
|
|||||||
if (!is_array($item)) {
|
if (!is_array($item)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return is_array(head($item)) || head($item) instanceof Buyable;
|
return is_array(head($item)) || head($item) instanceof Buyable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
throw new \InvalidArgumentException('Please supply a valid name.');
|
throw new \InvalidArgumentException('Please supply a valid name.');
|
||||||
}
|
}
|
||||||
if (strlen($price) < 0 ||!is_numeric($price)) {
|
if (strlen($price) < 0 || !is_numeric($price)) {
|
||||||
throw new \InvalidArgumentException('Please supply a valid price.');
|
throw new \InvalidArgumentException('Please supply a valid price.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,13 +371,14 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
return $this->discount * $this->qty;
|
return $this->discount * $this->qty;
|
||||||
case 'weightTotal':
|
case 'weightTotal':
|
||||||
return $this->weight * $this->qty;
|
return $this->weight * $this->qty;
|
||||||
|
|
||||||
case 'model':
|
case 'model':
|
||||||
if (isset($this->associatedModel)) {
|
if (isset($this->associatedModel)) {
|
||||||
return with(new $this->associatedModel)->find($this->id);
|
return with(new $this->associatedModel())->find($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
preset: laravel
|
preset: laravel
|
||||||
|
|
||||||
|
finder:
|
||||||
|
exclude:
|
||||||
|
- "tests"
|
||||||
Reference in New Issue
Block a user