| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function addTransaction(Transaction $transaction) |
||
| 31 | { |
||
| 32 | $id = $transaction->getId(); |
||
| 33 | if (array_key_exists($id, $this->transactions)) { |
||
| 34 | throw new InvalidArgumentException(sprintf( |
||
| 35 | 'Cannot add transaction with id %s, it already exists', |
||
| 36 | $id |
||
| 37 | )); |
||
| 38 | } |
||
| 39 | $this->transactions[$id] = $transaction; |
||
| 40 | } |
||
| 41 | } |
||
| 42 |