Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
42 | public static function fromArray(array $data, Configuration $configuration): DiscountTypeInterface |
||
43 | { |
||
44 | if (isset($data['net'])) { |
||
45 | $amount = new Money($data['net'], $configuration->getCurrency()); |
||
46 | $discount = Price::fromNetCost($amount, $configuration->getTaxRate()); |
||
47 | } else { |
||
48 | $amount = new Money($data['gross'], $configuration->getCurrency()); |
||
49 | $discount = Price::fromGrossCost($amount, $configuration->getTaxRate()); |
||
50 | } |
||
51 | |||
52 | return new static($discount); |
||
53 | } |
||
55 |