mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-11 18:54:33 +00:00
Style CI
This commit is contained in:
@@ -7,7 +7,7 @@ use Gloudemans\Shoppingcart\Contracts\Calculator;
|
||||
|
||||
class DefaultCalculator implements Calculator
|
||||
{
|
||||
static function getAttribute(string $attribute, CartItem $cartItem)
|
||||
public static function getAttribute(string $attribute, CartItem $cartItem)
|
||||
{
|
||||
$decimals = config('cart.format.decimals', 2);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use Gloudemans\Shoppingcart\Contracts\Calculator;
|
||||
|
||||
class GrossPrice implements Calculator
|
||||
{
|
||||
static function getAttribute(string $attribute, CartItem $cartItem)
|
||||
public static function getAttribute(string $attribute, CartItem $cartItem)
|
||||
{
|
||||
$decimals = config('cart.format.decimals', 2);
|
||||
|
||||
|
||||
@@ -402,13 +402,11 @@ class CartItem implements Arrayable, Jsonable
|
||||
}
|
||||
|
||||
$class = new ReflectionClass(config('cart.calculator', DefaultCalculator::class));
|
||||
if (!$class->implementsInterface(Calculator::class))
|
||||
{
|
||||
if (!$class->implementsInterface(Calculator::class)) {
|
||||
throw new InvalidCalculatorException('The configured Calculator seems to be invalid. Calculators have to implement the Calculator Contract.');
|
||||
}
|
||||
|
||||
return call_user_func($class->getName().'::getAttribute', $attribute, $this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,5 +6,5 @@ use Gloudemans\Shoppingcart\CartItem;
|
||||
|
||||
interface Calculator
|
||||
{
|
||||
static function getAttribute(string $attribute, CartItem $cartItem);
|
||||
}
|
||||
public static function getAttribute(string $attribute, CartItem $cartItem);
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ use RuntimeException;
|
||||
|
||||
class InvalidCalculatorException extends RuntimeException
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user