Exemplo n.º 1
0
 /**
  * @param TodoReminder $reminder
  * @throws Exception\InvalidReminder
  */
 public function remindAssignee(TodoReminder $reminder)
 {
     if ($this->status->isDone()) {
         throw Exception\TodoNotOpen::triedToAddReminder($reminder, $this->status);
     }
     if (!$this->reminder->equals($reminder)) {
         throw Exception\InvalidReminder::reminderNotCurrent($this->reminder, $reminder);
     }
     if (!$this->reminder->isOpen()) {
         throw Exception\InvalidReminder::alreadyReminded();
     }
     if ($reminder->isInTheFuture()) {
         throw Exception\InvalidReminder::reminderInTheFuture($reminder);
     }
     $this->recordThat(TodoAssigneeWasReminded::forAssignee($this->todoId, $this->assigneeId, $reminder->close()));
 }