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