| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | public function giveAway(UuidInterface $reservationId, \DateTime $givenAwayAt) |
||
| 29 | { |
||
| 30 | $reservation = $this->reservations->get($reservationId); |
||
| 31 | |||
| 32 | if ($this->reservations->existsAlreadyGivenOfBook($reservation->bookId())) { |
||
| 33 | throw new BookInReservationAlreadyGivenAway(sprintf('Book with id %s in reservation with id %s was already given away.', $reservation->bookId(), $reservation->id())); |
||
| 34 | } |
||
| 35 | |||
| 36 | $reservation->giveAway($givenAwayAt); |
||
| 37 | |||
| 38 | $this->reservations->save($reservation); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |