コード例 #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();
 }
コード例 #2
0
 /**
  * @param MarkTodoAsExpired $command
  */
 public function __invoke(MarkTodoAsExpired $command)
 {
     $todo = $this->todoList->get($command->todoId());
     if (!$todo) {
         throw TodoNotFound::withTodoId($command->todoId());
     }
     $todo->markAsExpired();
 }
コード例 #3
0
 /**
  * @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());
 }
コード例 #4
0
 /**
  * @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);
     }
 }
コード例 #5
0
 /**
  * @param MarkTodoAsDone $command
  */
 public function __invoke(MarkTodoAsDone $command)
 {
     $todo = $this->todoList->get($command->todoId());
     $todo->markAsDone();
 }
コード例 #6
0
 /**
  * @param AddDeadlineToTodo $command
  * @return void
  */
 public function __invoke(AddDeadlineToTodo $command)
 {
     $todo = $this->todoList->get($command->todoId());
     $todo->addDeadline($command->userId(), $command->deadline());
 }