1 | <?php |
||
11 | abstract class NotPurchasableException extends Exception |
||
12 | { |
||
13 | /** @var CartPositionInterface|null */ |
||
14 | protected $position; |
||
15 | |||
16 | /** |
||
17 | * @var ShoppingCart|null |
||
18 | */ |
||
19 | protected $cart; |
||
20 | |||
21 | public static function forPosition(CartPositionInterface $position, ShoppingCart $cart, string $message = '') |
||
30 | |||
31 | public static function forCart(ShoppingCart $cart, string $message = '') |
||
39 | |||
40 | public function getName() |
||
44 | |||
45 | /** |
||
46 | * Method SHOULD BE called when exception is caught. |
||
47 | * Child classes may override this method and add problem auto-resolving. |
||
48 | * |
||
49 | * @return bool whether exception was automatically resolved |
||
50 | */ |
||
51 | public function resolve(): bool |
||
55 | } |
||
56 |