/**
  * @param MarkTodoAsExpired $command
  */
 public function __invoke(MarkTodoAsExpired $command)
 {
     $todo = $this->todoList->get($command->todoId());
     if (!$todo) {
         throw TodoNotFound::withTodoId($command->todoId());
     }
     $todo->markAsExpired();
 }
 /**
  * @param ReopenTodo $command
  */
 public function __invoke(ReopenTodo $command)
 {
     $todo = $this->todoList->get($command->todoId());
     if (!$todo) {
         throw TodoNotFound::withTodoId($command->todoId());
     }
     $todo->reopenTodo();
 }
 /**
  * @param AddReminderToTodo $command
  */
 public function __invoke(AddReminderToTodo $command)
 {
     $todo = $this->todoList->get($command->todoId());
     if (!$todo) {
         throw TodoNotFound::withTodoId($command->todoId());
     }
     $todo->addReminder($command->userId(), $command->reminder());
 }
 /**
  * @param PostTodo $command
  * @throws \Prooph\ProophessorDo\Model\User\Exception\UserNotFound
  */
 public function __invoke(PostTodo $command)
 {
     $user = $this->userCollection->get($command->assigneeId());
     if (!$user) {
         throw UserNotFound::withUserId($command->assigneeId());
     }
     $todo = $user->postTodo($command->text(), $command->todoId());
     $this->todoList->add($todo);
 }
 /**
  * @param RemindTodoAssignee $command
  */
 public function __invoke(RemindTodoAssignee $command)
 {
     $todo = $this->todoList->get($command->todoId());
     if (!$todo) {
         throw TodoNotFound::withTodoId($command->todoId());
     }
     $reminder = $todo->reminder();
     if ($this->reminderShouldBeProcessed($todo, $reminder)) {
         $todo->remindAssignee($reminder);
     }
 }
 /**
  * @param MarkTodoAsDone $command
  */
 public function __invoke(MarkTodoAsDone $command)
 {
     $todo = $this->todoList->get($command->todoId());
     $todo->markAsDone();
 }
 /**
  * @param AddDeadlineToTodo $command
  * @return void
  */
 public function __invoke(AddDeadlineToTodo $command)
 {
     $todo = $this->todoList->get($command->todoId());
     $todo->addDeadline($command->userId(), $command->deadline());
 }