| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function purchase(Identity $identity, Product $product): Receipt |
||
| 28 | { |
||
| 29 | try { |
||
| 30 | $receipt = $this->store->purchase($identity, $product); |
||
| 31 | } catch (InsufficientFunds $e) { |
||
| 32 | $this->dispatcher->dispatch(Events::PURCHASE_REJECTED, new PurchaseRejected($identity, $product)); |
||
| 33 | |||
| 34 | throw $e; |
||
| 35 | } |
||
| 36 | |||
| 37 | $this->dispatcher->dispatch(Events::PURCHASE_FINISHED, new PurchaseFinished($receipt)); |
||
| 38 | |||
| 39 | return $receipt; |
||
| 40 | } |
||
| 42 |