Пример #1
0
 /**
  * @param ReopenTodo $command
  */
 public function __invoke(ReopenTodo $command)
 {
     $todo = $this->todoList->get($command->todoId());
     if (!$todo) {
         throw TodoNotFound::withTodoId($command->todoId());
     }
     $todo->reopenTodo();
 }
 /**
  * @param MarkTodoAsExpired $command
  */
 public function __invoke(MarkTodoAsExpired $command)
 {
     $todo = $this->todoList->get($command->todoId());
     if (!$todo) {
         throw TodoNotFound::withTodoId($command->todoId());
     }
     $todo->markAsExpired();
 }
 /**
  * @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 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);
     }
 }