| 1 | <?php |
||
| 7 | final class Reservation implements Aggregate |
||
| 8 | { |
||
| 9 | /** @var UuidInterface */ |
||
| 10 | private $reservationId; |
||
| 11 | /** @var UuidInterface */ |
||
| 12 | private $bookId; |
||
| 13 | /** @var string */ |
||
| 14 | private $email; |
||
| 15 | /** @var \DateTime */ |
||
| 16 | private $givenAwayAt; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param UuidInterface $reservationId |
||
| 20 | * @param UuidInterface $bookId |
||
| 21 | * @param string $email |
||
| 22 | */ |
||
| 23 | public function __construct(UuidInterface $reservationId, UuidInterface $bookId, $email) |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param \DateTime $givenAwayAt |
||
| 32 | */ |
||
| 33 | public function giveAway(\DateTime $givenAwayAt) |
||
| 34 | { |
||
| 35 | if ($this->isGivenAway()) { |
||
| 36 | return; |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->givenAwayAt = $givenAwayAt; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return bool |
||
| 44 | */ |
||
| 45 | public function isGivenAway() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return UuidInterface |
||
| 52 | */ |
||
| 53 | public function id() |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return UuidInterface |
||
| 60 | */ |
||
| 61 | public function bookId() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @return \DateTime |
||
| 68 | */ |
||
| 69 | public function givenAwayAt() |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @return string |
||
| 76 | */ |
||
| 77 | public function email() |
||
| 81 | } |
||
| 82 |