| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 11 | #[Package('checkout')] |
||
| 12 | class ShippingException extends HttpException |
||
| 13 | { |
||
| 14 | final public const SHIPPING_METHOD_NOT_FOUND = 'CHECKOUT__SHIPPING_METHOD_NOT_FOUND'; |
||
| 15 | |||
| 16 | final public const SHIPPING_METHOD_DUPLICATE_PRICE = 'CHECKOUT__DUPLICATE_SHIPPING_METHOD_PRICE'; |
||
| 17 | |||
| 18 | public static function shippingMethodNotFound(string $id, ?\Throwable $e = null): self |
||
| 19 | { |
||
| 20 | if (!Feature::isActive('v6.6.0.0')) { |
||
| 21 | return new ShippingMethodNotFoundException($id, $e); |
||
| 22 | } |
||
| 23 | |||
| 24 | return new self( |
||
| 25 | Response::HTTP_BAD_REQUEST, |
||
| 26 | self::SHIPPING_METHOD_NOT_FOUND, |
||
| 27 | 'Shipping method with id "{{ shippingMethodId }}" not found.', |
||
| 28 | ['shippingMethodId' => $id], |
||
| 29 | $e |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | |||
| 33 | public static function duplicateShippingMethodPrice(?\Throwable $e = null): self |
||
| 41 | ); |
||
| 42 | } |
||
| 44 |